This crate allows you to measure how long it takes for a program to execute in different clocks. It ports the functions of the boost-chrono and boost-timer libraries.
The following clocks and their corresponding timers are implemented.
SystemClock, SystemTimerSteadyClock, SteadyTimer if supported by the system.HighResolutionClock, HighResolutionTimerProcessRealCPUClock, ProcessRealCPUTimerProcessUserCPUClock, ProcessUserCPUTimerProcessSystemCPUClock, ProcessSystemCPUTimerProcessCPUClock, ProcessCPUTimerThreadClock, ThreadTimerAdd this to your Cargo.toml:
toml
[dependencies]
howlong = "0.1"
```rust use howlong::*;
let timer = HighResolutionTimer::new(); // do some computations println!("{:?} have passed.", timer.elapsed());
let timer = ProcessCPUTimer::new(); // do other computations println!("{}", timer.elapsed()); ```
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.