Skip to main content

Module diag

Module diag 

Source
Expand description

Runtime diagnostics: rolling frame-time statistics, core-tracked GPU-byte accounting, and the flags that gate the on-screen overlay (Plan 0011).

Two pieces live here, deliberately split so the math is testable without a clock (NFR 6 determinism):

  • FrameStats is a pure accumulator: it is fed explicit frame deltas and computes fps / average / p99 from a fixed-capacity ring. No clock, no allocation — its unit tests carry no wall-clock read.
  • Diag wraps it with the single gated monotonic clock read on the render path. That read is the one place core touches the wall clock; it is quarantined here (it never feeds DSP or scene animation, which stay a pure function of the input window + fixed step) and only runs while collection is enabled. See the risk note in Plan 0011.

Re-exports§

pub use crate::dsp::downbeat::DownbeatTerms;

Structs§

AnalysisMetrics
A snapshot of the analysis side of diagnostics: what the audio is doing, as against Metrics’s what the renderer is doing.
Diag
The render-side diagnostics state: the pure FrameStats, the gated clock, the GPU-byte / draw-call figures, and the two flags that control collection and the on-screen overlay.
FrameStats
Pure rolling frame-time accumulator. Fed explicit deltas (seconds); holds no clock, so it is fully unit-testable. Fixed capacity — no per-frame alloc.
Metrics
A snapshot of the current diagnostics, mirroring the C ABI RlxMetrics struct (ADR-0008) on the native side so both frontends surface identical numbers from one computation.