Library / Date and time / Date and time / MeasuringTimer
CLASS
MeasuringTimer
A stack-scoped RAII elapsed-time probe.
Fields 3
int64 startNanosString labelboolean reportOnExitConstructors 2
INIT(REFERENCE String label)
Start a labelled timer.
INIT()Start an unlabelled timer (reports under "timer").
Methods 5
METHOD elapsedNanos() RETURNS int64reads
Elapsed monotonic nanoseconds since construction.
METHOD report() RETURNS Stringreads
Human-readable elapsed time, auto-scaled to ns / us / ms / s, prefixed with the label: e.g. "parse phase: 1.234 ms".
METHOD show() RETURNS voidreads
Print the elapsed-time report line to stdout now. (Kept a normal method, not inlined into CLEANUP: the kernel's header-ordering scanner doesn't walk destructor bodies, so the Stdio dependency must surface from a scanned method to order EV_stdio.hpp ahead of this class.)
MODIFY METHOD silence() RETURNS voidmodifies
Suppress the automatic CLEANUP print — use elapsedNanos()/report() to read the value yourself.
MODIFY METHOD unsilence() RETURNS voidmodifies
Re-enable the automatic CLEANUP print.