timetrap
Description
timetrap library is intended to wrap your code and measure the time of its execution.
Install it as:
cargo install timetrap
Time
Example of use:
use timetrap::*;
trap!("section A", {
let a = 0;
...
});
which results in:
section A took 14.834µs
Memeory
Also with help of sysinfo you can measure memory usage in the same manner.
Example of use:
use timetrap::*;
trap_mem!("make_plot()", MemUnits.Kb, {
let a = 0;
...
});
which results in:
make_plot() took 928.328083ms
make_plot() consumed memory: 560.00Kb
make_plot() consumed swap: 0.00Kb