#stopwatch #high #accuracy #benchmarking #time #pause #intended

hrstopwatch

A high accuracy stopwatch, intended for benchmarking

4 releases

0.1.0 Oct 7, 2022
0.0.3 Sep 28, 2022
0.0.2 Sep 21, 2022
0.0.1 Sep 8, 2022

#10 in #accuracy

ISC license

8KB
171 lines

High Resolution Stopwatch

GitHub crates.io badge Docs.rs rustc requirements

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.

Usage

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());

Dependencies

~154MB
~2.5M SLoC