Crate measure_time [−] [src]
The crate provides macros, which measure the time in ms until end of scope
This is done by creating an object, which measures the time. The time is printed when the object is dropped.
log verson = "0.4" is required
Currently macro re-export is not supported in rust, so the user needs to macro_use
import the log module like in the example below:
Examples
#[macro_use] extern crate log; #[macro_use] extern crate measure_time; fn main() { info_time!("measure function"); { debug_time!(format!("{:?}", "measuring block")); let mut sum = 0; for el in 0..50000 { sum+=el; } println!("{:?}", sum); // --> prints "measuring block took 0.010ms" } trace_time!(format!("{:?}", "yep")); // --> prints "yep took ...", "measuring function took 0.0135ms" }
Reexports
pub extern crate log; |
Macros
debug_time |
logs the time with the debug! macro |
info_time |
logs the time with the info! macro |
print_time |
logs the time with the print! macro |
trace_time |
logs the time with the trace! macro |
Structs
MeasureTime |
Enums
MeasureTimeLogLevel |