diff --git a/src/hyperfine/timer/cputimer.rs b/src/hyperfine/timer/cputimer.rs index 853602d..0ad3c38 100644 --- a/src/hyperfine/timer/cputimer.rs +++ b/src/hyperfine/timer/cputimer.rs @@ -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 {