Skip to content
Snippets Groups Projects
Unverified Commit dd5b06e6 authored by Andrei Eres's avatar Andrei Eres Committed by GitHub
Browse files

[subsystem-benchmarks] Log standart deviation for subsystem-benchmarks (#4285)

Should help us to understand more what's happening between individual
runs and possibly adjust the number of runs
parent 8f5c8f73
Branches
No related merge requests found
Pipeline #469714 passed with warnings with stages
in 1 hour, 11 minutes, and 12 seconds
......@@ -161,6 +161,13 @@ impl ResourceUsage {
for (resource_name, values) in by_name {
let total = values.iter().map(|v| v.total).sum::<f64>() / values.len() as f64;
let per_block = values.iter().map(|v| v.per_block).sum::<f64>() / values.len() as f64;
let per_block_sd =
standard_deviation(&values.iter().map(|v| v.per_block).collect::<Vec<f64>>());
println!(
"[{}] standart_deviation {:.2}%",
resource_name,
per_block_sd / per_block * 100.0
);
average.push(Self { resource_name, total, per_block });
}
average
......@@ -179,3 +186,11 @@ pub struct ChartItem {
pub unit: String,
pub value: f64,
}
fn standard_deviation(values: &[f64]) -> f64 {
let n = values.len() as f64;
let mean = values.iter().sum::<f64>() / n;
let variance = values.iter().map(|v| (v - mean).powi(2)).sum::<f64>() / (n - 1.0);
variance.sqrt()
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment