Expand description
Latency histograms (plan.md Phase 12).
Four fixed-size, zero-allocation histograms — 16 log2-scaled buckets
each ([AtomicU32; 16]), bucket b covers [2^b, 2^(b+1)) cycles
(bucket 0 covers 0-1) — tracking:
Kind::IrqEntry: cycles from an interrupt firing tocrate::preempt::on_tickactually running. Recorded by the arch trap entry (whicheverrivet-arch-*crate captures a cycle stamp as early as possible in the handler).Kind::DispatchDecision: cycles spent insideon_tickitself — the scheduling decision’s own cost.Kind::CriticalSection: cycles held betweencrate::critical::enter’s entry and exit — a proxy for interrupt-latency impact (nothing can preempt the calling hart while held).Kind::SchedulingWake: cycles from a task becoming ready (sched::unblock/ready_add) to actually being dispatched Running.
Gated behind the latency-histograms feature (off by default — see
rivet/Cargo.toml): recording a sample is one cycle_count() read
plus one atomic increment, cheap but not free, and a cost-sensitive
board that never reads the histograms shouldn’t pay it unasked.
Enums§
Constants§
Functions§
- max_
cycles - Exact worst-case-observed cycle count for
kind(0 if never recorded) — see [MAX_CYCLES]’s own doc for why this exists alongside the bucketed histogram. - name
- Human-readable name, for
report(). - record
- See the feature-gated
recordabove; a no-op stub keeps call sites (arch crates,on_tick,critical::enter,sched::unblock) free of#[cfg]clutter when the feature is off. - snapshot
- Snapshot of one histogram’s 16 bucket counts.