Extract quantity and command helpers

This commit is contained in:
David Peter committed 2026-10-05 11:14:09 +02:00
1 parent ecf8a24b1e
commit b5f58651a1
5 files changed
+20 -12

No files matched your search

+1 -1
View File
@@ -266,7 +266,7 @@ impl Executor for ShellExecutor<'_> {
time_wall_clock: measurements.time_wall_clock_mean(),
time_user: measurements.time_user_mean(),
time_system: measurements.time_system_mean(),
peak_memory_usage: Information::zero(),
peak_memory_usage: measurements.peak_memory_usage_mean(),
exit_status: ExitStatus::default(),
});
+6 -7
View File
@@ -1,7 +1,7 @@
use std::process::ExitStatus;
use crate::quantity::statistics::{max, mean, median, min, modified_zscores, standard_deviation};
use crate::quantity::{second, Information, Time};
use crate::quantity::{Information, Time};
/// Performance measurements and exit status from running a single command
#[derive(Debug, Default, Copy, Clone)]
@@ -77,12 +77,7 @@ impl Measurements {
/// Compute modified Z-scores for the wall clock times.
pub fn modified_zscores(&self) -> Vec<f64> {
modified_zscores(
&self
.wall_clock_times()
.map(|t| t.get::<second>())
.collect::<Vec<_>>(),
)
modified_zscores(&self.wall_clock_times().collect::<Vec<_>>())
}
/// The average user time.
@@ -94,4 +89,8 @@ impl Measurements {
pub fn time_system_mean(&self) -> Time {
mean(self.measurements.iter().map(|m| m.time_system))
}
pub fn peak_memory_usage_mean(&self) -> Information {
mean(self.measurements.iter().map(|m| m.peak_memory_usage))
}
}