mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 17:11:28 +00:00
Move user and system time
This commit is contained in:
1 parent
14d773998a
commit
50232feb22
6 files changed
+106
-42
No files matched your search
@@ -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<_>>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user