mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-03 01:21:25 +00:00
Add dummy timer for Windows
This commit is contained in:
1 parent
fefb3f2c16
commit
1bdf5f3b8e
1 file changed
+11
-2
@@ -1,5 +1,3 @@
|
|||||||
use std::mem;
|
|
||||||
|
|
||||||
use hyperfine::internal::Second;
|
use hyperfine::internal::Second;
|
||||||
use hyperfine::timer::Timer;
|
use hyperfine::timer::Timer;
|
||||||
|
|
||||||
@@ -22,8 +20,10 @@ struct CPUInterval {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Read CPU execution times ('user' and 'system')
|
/// Read CPU execution times ('user' and 'system')
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
fn get_cpu_times() -> CPUTimes {
|
fn get_cpu_times() -> CPUTimes {
|
||||||
use libc::{getrusage, rusage, RUSAGE_CHILDREN};
|
use libc::{getrusage, rusage, RUSAGE_CHILDREN};
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
let result: rusage = unsafe {
|
let result: rusage = unsafe {
|
||||||
let mut buf = mem::zeroed();
|
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
|
/// Compute the time intervals in between two `CPUTimes` snapshots
|
||||||
fn cpu_time_interval(start: &CPUTimes, end: &CPUTimes) -> CPUInterval {
|
fn cpu_time_interval(start: &CPUTimes, end: &CPUTimes) -> CPUInterval {
|
||||||
CPUInterval {
|
CPUInterval {
|
||||||
|
|||||||
Reference in new issue
Block a user