mod.rs
This file
Path
src/timer/mod.rs
45 lines · 992 bytes · Rust
Last changed by
Move a few modules to utilDavid Peterbefore adoption5c634c9
History of this fileTake it
1use std::process::Child;23use crate::util::units::Second;45pub mod wallclocktimer;67#[cfg(windows)]8mod windows_timer;9#[cfg(windows)]10pub use self::windows_timer::get_cpu_timer;1112#[cfg(not(windows))]13mod unix_timer;14#[cfg(not(windows))]15pub use self::unix_timer::get_cpu_timer;1617/// Defines start functionality of a timer.18pub trait TimerStart {19 fn start() -> Self;20 fn start_for_process(process: &Child) -> Self;21}2223/// Defines stop functionality of a timer.24pub trait TimerStop {25 type Result;26 fn stop(&self) -> Self::Result;27}2829#[derive(Debug, Copy, Clone)]30pub struct CPUTimes {31 /// Total amount of time spent executing in user mode32 pub user_usec: i64,3334 /// Total amount of time spent executing in kernel mode35 pub system_usec: i64,36}3738#[derive(Debug, Copy, Clone)]39pub struct CPUInterval {40 /// Total amount of time spent executing in user mode41 pub user: Second,4243 /// Total amount of time spent executing in kernel mode44 pub system: Second,45}