A minimal no-thrills stopwatch. Returns time values as floats. Uses time::precise_time_ns
under the hood.
Add the dependency simple-stopwatch
to your Cargo.toml
file, for example:
toml
[dependencies]
simple-stopwatch="0.1.3"
Then import the stopwatch anywhere you would like to use it:
rust
extern crate simple_stopwatch;
use simple_stopwatch::Stopwatch;
```rust fn myfunction() { let sw = Stopwatch::startnew();
dosomeheavy_work();
let elapsedms = sw.ms(); println!("Time taken: {}ms", elapsedms); }
```