mstar.worker.phase_timer#
Per-phase timing of the worker’s threads, and the NVTX range that goes with
each phase. benchmark/worker_phases reads what this writes out.
Set MSTAR_PHASE_TIMING to a positive period (in passes) to turn it on; see
docs/environment_variables.rst.
Functions
|
|
Classes
|
Phase samples from the main, GPU and plan threads, written out once per |
- class mstar.worker.phase_timer.PhaseTimer(worker_id='', enable_nvtx=False, period=PHASE_PERIOD)[source]#
Bases:
objectPhase samples from the main, GPU and plan threads, written out once per
periodpasses of the main loop.periodandbufare read directly on hot paths, behindif timer.period, so that an untimed step does not pay for a call.- pass_done(rows, started, started_cpu)[source]#
A pass of the main loop submitted a step of
rowsrows. Only called with timing on.
- record_gpu_span(start, end, key)[source]#
A step’s device time, as two timing events recorded around it. Drained here rather than at
flush: the deque holds fewer steps than a period usually runs.
- span(name, cpu=None)[source]#
One NVTX range plus one phase sample, same name.
cpunames a second sample: this thread’s CPU time over the span. Wall minus CPU is time spent blocked – on an event, a lock or the GIL – which a wall-clock span alone cannot tell from work.Safe off the main thread: the append is the only shared mutation and
flushsnapshots before it clears.