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.

The logging behaviour is the same as other log macros like info!(..)

Examples

#[macro_use]
extern crate measure_time;
fn main() {
    info_time!("measure function");
    {
        debug_time!("{:?}", "measuring block");
        let mut sum = 0;
        for el in 0..50000 {
            sum+=el;
        }
        println!("{:?}", sum);
    }
    trace_time!("{:?}", "trace");
    print_time!("print");
    error_time!(target: "measure_time", "custom target");
    // --> prints "yep took ...", "measuring function took 0.0135ms"
}

Re-exports

pub extern crate log;
pub use log::*;

Macros

debug

Logs a message at the debug level.

debug_time

logs the time with the debug! macro

error

Logs a message at the error level.

error_time

logs the time with the error! macro

info

Logs a message at the info level.

info_time

logs the time with the info! macro

log

The standard logging macro.

log_enabled

Determines if a message logged at the specified level in that module will be logged.

log_time
print_time

logs the time with the print! macro

trace

Logs a message at the trace level.

trace_time

logs the time with the trace! macro

warn

Logs a message at the warn level.

warn_time

logs the time with the warn! macro

Structs

MeasureTime