howlong

Crates.iohowlong
lib.rshowlong
version0.1.7
sourcesrc
created_at2019-12-05 13:15:55.503058
updated_at2021-04-05 12:26:38.425378
descriptionMeasure how long it takes for a program to execute in different clocks
homepage
repositoryhttps://github.com/xu-cheng/howlong
max_upload_size
id186655
size57,168
Cheng XU (xu-cheng)

documentation

https://docs.rs/howlong

README

howlong

Build Status Latest Version Rust Documentation

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, SystemTimer
  • SteadyClock, SteadyTimer if supported by the system.
  • HighResolutionClock, HighResolutionTimer
  • ProcessRealCPUClock, ProcessRealCPUTimer
  • ProcessUserCPUClock, ProcessUserCPUTimer
  • ProcessSystemCPUClock, ProcessSystemCPUTimer
  • ProcessCPUClock, ProcessCPUTimer
  • ThreadClock, ThreadTimer

Documentation

https://docs.rs/howlong

Usage

Add this to your Cargo.toml:

[dependencies]
howlong = "0.1"

Examples

let timer = howlong::HighResolutionTimer::new();
// do some computations
println!("{:?} have passed.", timer.elapsed());

let timer = howlong::ProcessCPUTimer::new();
// do other computations
println!("{}", timer.elapsed()); // 5.71s wall, 5.70s user + 0ns system = 5.70s CPU (99.8%)

License

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.
Commit count: 70

cargo fmt