| Crates.io | timetrap |
| lib.rs | timetrap |
| version | 0.1.2 |
| created_at | 2025-03-30 22:05:55.039607+00 |
| updated_at | 2025-04-02 00:09:14.162039+00 |
| description | Macros to wrap your code and measure time |
| homepage | https://github.com/vladneyo/timetrap |
| repository | https://github.com/vladneyo/timetrap |
| max_upload_size | |
| id | 1612814 |
| size | 23,405 |
timetrap library is intended to wrap your code and measure the time of its execution.
cargo install timetrap
use timetrap::*;
trap!("section A", {
let a = 0;
...
});
which results in:
section A took 14.834µs
Also with help of sysinfo you can measure memory usage in the same manner.
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