Crate measure_time

source ·
Expand description

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

use measure_time::{info_time, debug_time, trace_time, error_time, print_time};
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"

Macros§

  • Logs a message at the debug level.
  • logs the time with the debug! macro
  • Logs a message at the error level.
  • logs the time with the error! macro
  • Logs a message at the info level.
  • logs the time with the info! macro
  • The standard logging macro.
  • Determines if a message logged at the specified level in that module will be logged.
  • logs the time with the print! macro
  • Logs a message at the trace level.
  • logs the time with the trace! macro
  • Logs a message at the warn level.
  • logs the time with the warn! macro

Structs§

Enums§

  • An enum representing the available verbosity levels of the logger.
  • An enum representing the available verbosity level filters of the logger.

Constants§

Traits§

  • A trait encapsulating the operations required of a logger.

Functions§