Expand description
Lightweight CPU timing spans, drained per frame by the preview
profiler panel.
Lightweight CPU timing spans, mirroring crate::upload_probe and the
GPU timer scopes: leaf-level named spans recorded into a thread-local
buffer, drained once per frame by the consumer (the preview profiler
panel).
Spans are always recorded (a span costs two Instant::now reads, ~50ns)
and are leaf-level only โ never nest them, so the frame total is the
sum of all spans without double counting. If nobody drains the buffer
(e.g. the CLI render worker thread), it self-clears at a span cap so
memory stays bounded.
Structsยง
- Span
- A scoped CPU timing span. Records
(label, ms)into the thread-local frame buffer when dropped.
Constantsยง
- MAX_
SPANS ๐ - Upper bound on buffered spans; exceeding it clears the buffer (the consumer is expected to drain every frame).
- SPANS ๐
Functionsยง
- span
- Start a named leaf-level CPU span (records on scope exit):
- take_
frame - Drain the spans recorded on this thread since the last call.