Move user and system time

This commit is contained in:
David Peter authored and David Peter committed 2026-10-05 15:56:36 +02:00
1 parent 14d773998a
commit 50232feb22
6 files changed
+106 -42

No files matched your search

+27 -8
View File
@@ -10,9 +10,14 @@ use crate::util::{
#[derive(Debug, Default, Clone, Serialize, PartialEq)]
pub struct BenchmarkRun {
/// Wall clock time measurement
pub wall_clock_time: Second,
// user_time: Second,
// system_time: Second,
/// Time spent in user mode
pub user_time: Second,
/// Time spent in kernel mode
pub system_time: Second,
}
use crate::benchmark::measurement::Measurements;
@@ -37,12 +42,6 @@ pub struct BenchmarkResult {
/// The full command line, including parameters not used in the command template.
pub command_with_unused_parameters: String,
/// Time spent in user mode
pub user: f64,
/// Time spent in kernel mode
pub system: f64,
/// All run time measurements
pub runs: Vec<BenchmarkRun>,
@@ -157,4 +156,24 @@ impl BenchmarkResult {
pub fn max(&self) -> Second {
max(&self.wall_clock_times())
}
pub fn user_mean(&self) -> Second {
mean(
&self
.runs
.iter()
.map(|run| run.user_time)
.collect::<Vec<_>>(),
)
}
pub fn system_mean(&self) -> Second {
mean(
&self
.runs
.iter()
.map(|run| run.system_time)
.collect::<Vec<_>>(),
)
}
}