exec_time
Attribute macro for printing sync and async function execution time.
Install
[]
= "0.1.7"
MSRV: Rust 1.88.
Default
use exec_time;
[exec_time] login took 102 ms
Slow Calls
use exec_time;
[exec_time] cache.lookup took 734 us
[exec_time][warn] db.query took 312 ms
Options
print = "always" | "debug" | "never": controls whether timing is emitted. Default:always.name = "...": replaces the generated label.prefix = "...",suffix = "...": build the label as<prefix>::<function>::<suffix>. Ignored whennameis set.unit = "ns" | "us" | "ms" | "s": output unit. Default:ms.log_over = "...": print only when execution time meets or exceeds the threshold.warn_over = "...": write a warning tostderronly when execution time meets or exceeds the threshold.
Threshold values support ns, us, ms, and s, for example 500us, 5ms, or 0.5s.
Rules
- Default output format:
[exec_time] <label> took <value> <unit> warn_overtakes precedence overlog_overwhen both thresholds matchprint = "never"disables all output