1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2024-2026 Jonathan Shook
// SPDX-License-Identifier: Apache-2.0
//! **Summaries** — retained, transforming views of instrument data.
//!
//! A summary sits *downstream* of a primary instrument (see
//! [`crate::instruments`]) or the scheduler's cascade output,
//! and holds a transformed view of that data for on-demand
//! reads. Unlike primary instruments — recorded into on the hot
//! path, drained on every scheduler tick — a summary:
//!
//! - **Is fed from outside the hot path.** Typically attached as
//! a consumer of a rate, a gauge, a counter's rate-of-change, or
//! a histogram snapshot. Recording into a summary is not on the
//! workload's critical path.
//! - **Retains data across drains.** A primary histogram resets on
//! `capture_delta`; a summary keeps whatever representation it's
//! built up, up to its caller-specified bound.
//! - **Transforms the stream.** Binomial reduction, sliding-window
//! aggregation, or lossless sorted accumulation — the summary
//! decides how to compact the stream.
//! - **Is read on demand.** Snapshots are non-mutating clones; a
//! display can poll arbitrarily without perturbing state.
//! - **Attaches for a scope.** The lifetime is usually a UI view
//! (a TUI panel, a report cell) or a phase. When the source
//! stops feeding it, the summary's contents are naturally
//! frozen — no further records arrive, so the last snapshot
//! remains the durable artifact.
//!
//! ## What lives here
//!
//! - [`binomial_summary::BinomialSummary`] — bounded sparkline
//! buffer with binomial (pairwise-averaging) reduction on
//! overflow. Used for phase-scoped throughput sparklines.
//! - [`ewma::Ewma`] — time-weighted exponentially-weighted
//! moving average. Single-scalar "current value" readout
//! that doesn't flicker when the raw stream is noisy.
//! - [`f64stats::F64Stats`] — lossless f64 accumulator with
//! exact percentiles. Used for relevancy scores (recall,
//! precision).
//! - [`hdr_summary::HdrSummary`] — retained, non-draining HDR
//! histogram for lossless latency percentiles over a scope
//! (whole phase, whole run, analysis window).
//! - [`live_window::LiveWindowHistogram`] — sliding-window HDR
//! histogram with lazy per-slot reset. Optional live-peek
//! sibling of [`crate::instruments::timer::Timer`] for the
//! TUI's 1-second rolling latency view.
//! - [`peak_tracker::PeakTracker`] — rolling max (or min) over
//! a wall-clock window via a monotonic deque. O(1) amortized.
//!
//! See SRD 62 §"Design notes → Per-phase sparkline: binomial-
//! reduction summary instrument" for the architectural position.