timetrap library is intended to wrap your code and measure the time of its execution.
timetrap
cargo install timetrap
use timetrap::trap; trap!({ let a = 0; ... });