Expand description
Phase timing for --profile.
trace answers “what did this run decide?” — the resolved
root, coverage, what got warmed. This answers “where did the time go?”, and
keeps the two apart: trace lines are prose meant to be read as they happen,
phases are a table meant to be compared against another run.
Off by default and free when off, on the same terms as trace: a span reads no clock, takes no lock and allocates nothing unless profiling is on, so the only cost left on the search path is a relaxed atomic load per phase.
Streaming makes one measurement matter more than the total: first result
is the number the sub-50 ms budget is about, and a change that improves the
total while delaying the first answer is a regression here.
Structs§
Functions§
- enable_
from - Enable profiling from the
--profileflag;RQ_PROFILEin the environment also enables it, so a shipped binary can be measured in place — the same affordanceRQ_LOGgives trace. - enabled
- json
- Phases as JSON, for storing a baseline and diffing runs.
- phases
- Every phase recorded so far, in the order they finished. Drains.
- record
- Record a phase whose duration was measured elsewhere — for the timings the search path already takes for its own trace lines.
- report
- The report as stderr-ready lines. Empty when nothing was measured.
- span
- Start timing a phase. The returned span records it when dropped; with profiling off it is inert.