Expand description
Unified periodic-sample bundle and series projection.
At every periodic boundary (see super::snapshot and the
freeze coordinator’s periodic-capture loop), the framework
captures a coupled FailureDumpReport + scx_stats JSON pair.
Sample is the borrowed-view tuple over that pair plus the
per-sample tag and elapsed-millisecond timestamp;
SampleSeries is the ordered sequence of samples drained
from a SnapshotBridge after VM exit.
Test authors do not construct samples manually — they call
SampleSeries::from_drained on the periodic bundle the
bridge surfaces via
SnapshotBridge::drain_ordered_with_stats, then project the
series along one of four orthogonal axes:
- bpf — kernel BPF state through
SampleSeries::bpf/ the typedSampleSeries::bpf_maphelper. - stats — userspace scx_stats JSON through
SampleSeries::stats/ the typedSampleSeries::stats_pathhelper. - host — per-sample per-CPU host timeline through
SampleSeries::host(sourced fromFailureDumpReport::per_cpu_time). - monitor — per-VM-run cross-CPU host monitor aggregate
through
SampleSeries::monitor(sourced fromMonitorReport::summary).
Each projection yields a
crate::assert::temporal::SeriesField that
flows into the temporal-assertion patterns
(nondecreasing, rate_within, steady_within,
converges_to, always_true, ratio_within) defined in
crate::assert::temporal.
§Lifetime model
SampleSeries owns the drained Vec<SampleRow> (each row:
tag, report, stats, elapsed_ms, boundary_offset_ms, step_index)
so projection closures can borrow into the
reports / stats without copying. Constructing a Sample only
borrows; SampleSeries::iter_samples yields Sample<'_>
bound by the series’ own lifetime.
Structs§
- BpfMap
CpuProjector - Single-CPU view of a per-CPU BPF map, returned by
BpfMapProjector::cpu. Itsfield_*read the chosen CPU’s slot of the map’s per-CPU value — the per-CPU SELECT counterpart to the cross-CPUBpfMapProjector::field_cpu_sum_u64reductions. - BpfMap
Projector - Auto-projector handle returned by
SampleSeries::bpf_map. Lazily resolves the named map’s value at the requested entry index whenSelf::fieldis invoked. - Host
View - Borrowed view over the per-sample per-CPU
PerCpuTimeStatsdata that the host capture pipeline populates into eachFailureDumpReport::per_cpu_time. Returned bySampleSeries::host; exposes a per-CPU timeline (rows sorted ascending by elapsed-ms, stable on ties) plus a closure-based projector that emits aSeriesField<u64>compatible with the temporal-assertion patterns incrate::assert::temporal. - Monitor
View - Borrowed view over a per-VM-run
MonitorReport. Returned bySampleSeries::monitor; provides typed access to the report’s summary statistics + the SCX event-counter deltas. - Sample
- One captured periodic sample: a frozen BPF snapshot paired with
the scx_stats JSON observed just before the freeze rendezvous,
labelled with the periodic tag (
periodic_000…periodic_NNN) and tagged with the elapsed milliseconds sincerun_start. - Sample
Series - Ordered collection of
Samples drained from aSnapshotBridgeafter a VM run completes. Owns the underlying tuples so projection closures can borrow into the reports / stats without copying. - ScxEvents
View - Borrowed view over the
ScxEventDeltasaggregated across the monitor’s first/last sample window. Returned byMonitorView::scx_events; exposes the 14 i64 counter totals viaSelf::total_pairsand the 2 f64 derived rates viaSelf::rates_pairs. - Stats
Path Projector - Auto-projector handle returned by
SampleSeries::stats_path. Walks a stats sub-tree per sample and exposes scalar / nested projections for the keys at that level. - Stats
Value - Newtype carrier handed to the
SampleSeries::statsclosure. Wraps a borrowedserde_json::Valueand exposesSelf::getas a thin facade overstats_pathso the closure body readss.get("layers.batch.util").as_f64()without an explicit import. The.get(path)name mirrorscrate::scenario::snapshot::SnapshotField::getandcrate::scenario::snapshot::JsonField::getso test authors see one navigator vocabulary across every accessor surface.
Constants§
- ERROR_
CLASS_ NAMES - Default curated subset of
ScxEventsView::total_pairscounter names that signal genuine scheduler-class errors when non-zero. Used to filter the full 14-entry total slice down to the entries that callers conventionally bound at zero withcrate::assert::assert_scx_events_clean.