Measure work time for logging


I’m searching for program samples/crate/crates to simplify writing
to log work time of some “heavy” algorithm.
It is not for benchmarking, just for control application on production.

In ideal word it should be something like:

//at the start of function
let _ = MeasureTime::<LoggingStrategy>::new();

and that’s all, MeasureTime should implement Drop interface and
write to log according to LoggingStrategy.

Is anything similar to this?

As I know, there is std::time and time crate to measure absolute work time,
but what about measure CPU usage time, like clock function in libc (or getrusage, or clock_gettime)?