calculate std

This commit is contained in:
Youngjoon Lee 2024-12-10 16:38:53 +09:00
parent 0c03dcde86
commit d2271a9fde
No known key found for this signature in database
GPG Key ID: 167546E2D1712F8C
2 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,9 @@ def analyze_monitors(input_stream: Iterable[str]) -> None:
"min": df["min"].min(), "min": df["min"].min(),
"avg": (df["num_conns"] * df["avg"]).sum() / df["num_conns"].sum(), "avg": (df["num_conns"] * df["avg"]).sum() / df["num_conns"].sum(),
"max": df["max"].max(), "max": df["max"].max(),
"std_min": df["std"].min(),
"std_avg": df["std"].mean(),
"std_max": df["std"].max(),
} }
print(result) print(result)

View File

@ -333,6 +333,7 @@ impl MixNode {
avg: effective_messages_series.mean().unwrap(), avg: effective_messages_series.mean().unwrap(),
median: effective_messages_series.median().unwrap(), median: effective_messages_series.median().unwrap(),
max: effective_messages_series.max().unwrap().unwrap(), max: effective_messages_series.max().unwrap().unwrap(),
std: effective_messages_series.std(0).unwrap(),
}; };
tracing::info!("Monitor: {}", serde_json::to_string(&log).unwrap()); tracing::info!("Monitor: {}", serde_json::to_string(&log).unwrap());
} }
@ -474,4 +475,5 @@ struct MonitorsLog {
avg: f64, avg: f64,
median: f64, median: f64,
max: u64, max: u64,
std: f64,
} }