Expand description
Per-block phase timing for debug builds, enabled with DRIVE_BLOCK_PERF=1. Lightweight per-block phase timing for debug builds.
This module and all timing call sites are compiled only with debug assertions
enabled. Standard release builds exclude the instrumentation entirely, even
when DRIVE_BLOCK_PERF=1 is set.
In debug builds, enabled only when DRIVE_BLOCK_PERF=1 is set in the
environment. Phases are accumulated in memory and reported as means every
DRIVE_BLOCK_PERF_EVERY blocks (default 500), so the measurement does not
pay for a log line inside the very spans it is measuring.
This is read straight from the environment rather than through
PlatformConfig on purpose: it is a developer switch for replay benchmarks,
it must cost nothing when off, and it should not need a config change to be
flipped on a node under investigation.
Each [PhaseTimer] belongs to a scope, normally the function it lives in,
and every phase is reported as scope.phase. Phases are named after the
call they time, so a term in the report can be grepped straight to the code.
Phases nest where a handler times a call whose body is itself timed:
finalize_block.finalize_block_proposal covers all of the
finalize_block_proposal.* phases. Add up phases from one level only.
Structs§
- Phase
Timer - Times the successive phases of one function during block execution.
Functions§
- end_
block - Called once per finalized block. Emits the means and resets every
DRIVE_BLOCK_PERF_EVERYblocks.