measure#

Profiler.measure(name: str)#

Time the wrapped block and accumulate it under name.

Parameters:
namestr

Leaf name for this measurement. The recorded category is the slash-joined concatenation of all enclosing measure blocks plus this name (e.g. "compute_gradient/set_adj").

Yields:
None

Yields control back to the caller for the duration of the measurement.

Notes

Safe to use on disabled profilers: the context is still entered and exited but no time is recorded.