Crates.io | hrstopwatch |
lib.rs | hrstopwatch |
version | 0.1.0 |
source | src |
created_at | 2022-09-08 03:18:51.57217 |
updated_at | 2022-10-07 08:38:23.502326 |
description | A high accuracy stopwatch, intended for benchmarking. |
homepage | |
repository | https://github.com/Starz0r/hrstopwatch |
max_upload_size | |
id | 660759 |
size | 9,202 |
An extremely accurate clock for taking measurements of the length of time between it starting and stopping. Includes the capability to pause and resume. Inspired by https://github.com/moritzrinow/winwatch. Windows Only.
use hrstopwatch::Stopwatch;
let mut num: u64 = 0;
let mut stopwatch = Stopwatch::start()?;
for i in 0..10000 {
num += i;
}
stopwatch.stop()?;
println!("seconds to calculate: {}", stopwatch.elapsed_seconds_f64());