mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-29 16:38:56 +00:00
Flat directory/module structure
This commit is contained in:
1 parent
d31936ec28
commit
30c381fe2a
27 files changed
+70
-71
No files matched your search
@@ -0,0 +1,30 @@
|
||||
use std::process::Child;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::timer::{TimerStart, TimerStop};
|
||||
use crate::units::Second;
|
||||
|
||||
pub struct WallClockTimer {
|
||||
start: Instant,
|
||||
}
|
||||
|
||||
impl TimerStart for WallClockTimer {
|
||||
fn start() -> WallClockTimer {
|
||||
WallClockTimer {
|
||||
start: Instant::now(),
|
||||
}
|
||||
}
|
||||
|
||||
fn start_for_process(_: &Child) -> Self {
|
||||
Self::start()
|
||||
}
|
||||
}
|
||||
|
||||
impl TimerStop for WallClockTimer {
|
||||
type Result = Second;
|
||||
|
||||
fn stop(&self) -> Second {
|
||||
let duration = self.start.elapsed();
|
||||
duration.as_secs() as f64 + f64::from(duration.subsec_nanos()) * 1e-9
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user