The crate provides macros, which measure the time until end of scope.
This is done by creating an object, which measures the time. The time is printed when the object is dropped.
Simply add a corresponding entry to your Cargo.toml
dependency list:
toml,ignore
[dependencies]
measure_time = "0.4"
log = "0.4"
And add this to your crate root (e.g. lib.rs/main.rs):
```rust,ignore
extern crate measure_time;
extern crate log; ```
```rust
extern crate measure_time;
extern crate log; fn main() { infotime!("measure function"); { debugtime!(format!("{:?}", "measuring block")); let mut sum = 0; for el in 0..50000 { sum+=el; } println!("{:?}", sum); } tracetime!(format!("{:?}", "yep")); printtime!("yep2"); } ```
Objects to measure time are only created when the log level is enabled, else None
will be created
Add error and warn levels