mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Refactoring
This commit is contained in:
1 parent
be66a6668f
commit
71365c227e
6 files changed
+34
-64
No files matched your search
+2
-2
@@ -82,14 +82,14 @@ pub fn execute_and_measure(mut command: Command) -> Result<Measurement> {
|
||||
discard(output);
|
||||
}
|
||||
|
||||
let (exit_status, time_user, time_system, memory_usage_byte) = cpu_timer.stop(child)?;
|
||||
let (time_user, time_system, peak_memory_usage, exit_status) = cpu_timer.stop(child)?;
|
||||
let time_wall_clock = wallclock_timer.stop();
|
||||
|
||||
Ok(Measurement {
|
||||
time_wall_clock,
|
||||
time_user,
|
||||
time_system,
|
||||
peak_memory_usage: memory_usage_byte,
|
||||
peak_memory_usage,
|
||||
exit_status,
|
||||
})
|
||||
}
|
||||
@@ -70,13 +70,13 @@ impl CPUTimer {
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub fn stop(&self, child: Child) -> Result<(ExitStatus, Time, Time, Information)> {
|
||||
pub fn stop(&self, child: Child) -> Result<(Time, Time, Information, ExitStatus)> {
|
||||
let (status, usage) = wait4(child)?;
|
||||
Ok((
|
||||
status,
|
||||
usage.time_user,
|
||||
usage.time_system,
|
||||
usage.memory_usage,
|
||||
status,
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ impl CPUTimer {
|
||||
Self { job_object }
|
||||
}
|
||||
|
||||
pub fn stop(&self, mut child: Child) -> Result<(ExitStatus, Time, Time, Information)> {
|
||||
pub fn stop(&self, mut child: Child) -> Result<(Time, Time, Information, ExitStatus)> {
|
||||
let status = child.wait()?;
|
||||
|
||||
let mut job_object_info =
|
||||
@@ -116,9 +116,9 @@ impl CPUTimer {
|
||||
let system_time =
|
||||
Time::from_nanoseconds((job_object_info.TotalKernelTime as f64) * 100.0);
|
||||
|
||||
Ok((status, user_time, system_time, Information::zero()))
|
||||
Ok((user_time, system_time, Information::zero(), status))
|
||||
} else {
|
||||
Ok((status, Time::zero(), Time::zero(), Information::zero()))
|
||||
Ok((Time::zero(), Time::zero(), Information::zero(), status))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user