Add dummy timer for Windows

This commit is contained in:
sharkdp authored and David Peter committed 2018-02-02 22:42:53 +01:00
1 parent fefb3f2c16
commit 1bdf5f3b8e
1 file changed
+11 -2
+11 -2
View File
@@ -1,5 +1,3 @@
use std::mem;
use hyperfine::internal::Second;
use hyperfine::timer::Timer;
@@ -22,8 +20,10 @@ struct CPUInterval {
}
/// Read CPU execution times ('user' and 'system')
#[cfg(not(target_os = "windows"))]
fn get_cpu_times() -> CPUTimes {
use libc::{getrusage, rusage, RUSAGE_CHILDREN};
use std::mem;
let result: rusage = unsafe {
let mut buf = mem::zeroed();
@@ -42,6 +42,15 @@ fn get_cpu_times() -> CPUTimes {
}
}
/// Read CPU execution times (dummy for now)
#[cfg(windows)]
fn get_cpu_times() -> CPUTimes {
CPUTimes {
user_usec: 0,
system_usec: 0,
}
}
/// Compute the time intervals in between two `CPUTimes` snapshots
fn cpu_time_interval(start: &CPUTimes, end: &CPUTimes) -> CPUInterval {
CPUInterval {