Expand description
Build progress: where a running build is, for a renderer on another
thread — what rete build|merge|recard --progress draws.
crate::build_trace records what a build did, on the build’s own thread,
for the build record. This is its live sibling: the builders publish the
phase they enter, how far through it they are, and a few running totals into
process-wide atomics, which a renderer samples whenever it likes.
Nothing is published until someone listens. Until then every call is one
relaxed atomic load and a branch, and a Ticker — the per-record counter
the hot loops use — adds to a local integer and publishes once per
Ticker::EVERY records. On wasm32 every function is a no-op.
The figures are progress, not accounting: a phase’s done may stop short
of its total (a deduplicating merge reads fewer records than were
spilled), and a renderer clamps it to the total.
Structs§
- Listener
- Publishes for as long as it lives; see
listen. - Snapshot
- One sample of the published state.
- Ticker
- A per-record counter for a hot loop:
tickadds to a local integer and publishes (advance) once perSelf::EVERYrecords, and what is left when it is dropped.
Enums§
Functions§
- advance
- Add
nto the current phase’sdone. - begin
- Enter
phase:donerestarts at 0 againsttotal(Nonewhen nothing bounds it). - listen
- Start publishing, from a clean slate. Builds that run while the returned guard lives publish their progress; drop it to stop.
- listening
- True while a
Listenerlives. - set_
done - Set the current phase’s
done. - set_
spill_ dir - Name the directory the build spills into (
Noneonce it is gone), so a renderer can show how much it holds. - set_
stat - Set a running total.
- set_
total - Set the current phase’s total once it is known.
- snapshot
- Read the published state. The phase, its
done,totalandunitare read as one: a sample never pairs a new phase with the last one’s figures.