Expand description
PMAT-284: Lightweight sub-phase timing for CPU-GPU pipelining analysis
PhaseTimer captures named sub-phases within a hot loop with minimal
overhead when disabled. Designed for iteration-scheduler-level instrumentation
where BrickProfiler (GPU-side) and InferenceTracer (model-level) don’t apply.
§Usage
ⓘ
let mut timer = PhaseTimer::from_env("PMAT_283_TIMING");
loop {
timer.start();
timer.mark("lock"); // write lock acquired
// ... scheduling ...
timer.mark("sched"); // scheduling done
// ... decode step ...
timer.mark("decode"); // GPU decode done
// ... token distribution ...
timer.mark("dist"); // tokens distributed
timer.emit(iteration, batch_size); // prints if enabled + interval
}Output: [PMAT-283] iter=42, m=4: lock=3µs sched=12µs decode=7412µs dist=84µs total=7511µs
Structs§
- Phase
Timer - Lightweight sub-phase timer for hot-path instrumentation.