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

step_key(node_name, graph_walk)

step.<node>.<walk>, as a phase name (benchmark/worker_phases reads names of word characters and dots).

Classes

PhaseTimer([worker_id, enable_nvtx, period])

Phase samples from the main, GPU and plan threads, written out once per period passes of the main loop.

class mstar.worker.phase_timer.PhaseTimer(worker_id='', enable_nvtx=False, period=PHASE_PERIOD)[source]#

Bases: object

Phase samples from the main, GPU and plan threads, written out once per period passes of the main loop.

period and buf are read directly on hot paths, behind if timer.period, so that an untimed step does not pay for a call.

Parameters:
flush()[source]#

Log the window’s samples and start a new one.

Return type:

None

pass_done(rows, started, started_cpu)[source]#

A pass of the main loop submitted a step of rows rows. Only called with timing on.

Parameters:
Return type:

None

record(name, dt)[source]#

A sample timed elsewhere.

Parameters:
Return type:

None

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.

Parameters:
Return type:

None

span(name, cpu=None)[source]#

One NVTX range plus one phase sample, same name.

cpu names 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 flush snapshots before it clears.

Parameters:
Return type:

Iterator[None]

track_gc()[source]#

Time collections from now on, once warmup is out of the way.

Return type:

None

mstar.worker.phase_timer.step_key(node_name, graph_walk)[source]#

step.<node>.<walk>, as a phase name (benchmark/worker_phases reads names of word characters and dots).

Parameters:
  • node_name (str)

  • graph_walk (str)

Return type:

str