Expand description
Lightweight, opt-in timing instrumentation.
Enabled by setting the CHARON_TIMINGS environment variable. Set it to 1 to get a
human-readable report on stderr at the end of the run; set it to a file path to additionally
append the measurements as csv lines to that file.
Scopes can be nested: we report both the total (wall) time spent in a scope and the “self” time, i.e. the time not spent inside a nested instrumented scope.
Structs§
Constants§
- NESTED 🔒
- Time spent in nested scopes, for the currently-running scope.
Statics§
- MEASURES 🔒
- Measurements are aggregated globally (translation is single-threaded but rustc may call us from several threads, hence the mutex).
- SETTING 🔒
- Whether timing is enabled at all.
Functions§
- enabled
- report
- Print the timing report on stderr, and append it to the file given in
CHARON_TIMINGSif it isn’t1. - scope
- Time the given scope, if timings are enabled.
- scope_
lazy - Same as
scope_withbut only computes the suffix if timings are enabled. - scope_
with - Same as
scopebut allows refining the name dynamically. - time
- Time the given closure.