Crate macrotime

Source
Expand description

§MacroTime

MacroTime is very easy to use. To time the execution of a block of code:

use macrotime::*;
let time = time!({
    // do some stuff...
});
println!("This operation took {} ms!", time.as_millis());

You can also have MacroTime print the time taken to perform a task on its own. To do this:

use macrotime::*;
dbg_time!("context...", {
    // do some stuff...
});

In this scenario, the time will printed in the most relevant unit, so no need for formatting.

Macros§

dbg_time
Prints the execution time of the provided expression along with a relevant title/message.
time
Returns a Duration of the execution time of the provided expression.