#[non_exhaustive]pub struct MonitorView<'a> { /* private fields */ }Expand description
Borrowed view over a per-VM-run MonitorReport. Returned by
SampleSeries::monitor; provides typed access to the report’s
summary statistics + the SCX event-counter deltas.
Aggregates here refer to the monitoring window of THE SERIES THIS VIEW WAS DRAWN FROM — not the entire test run, not cumulative across series. A test that wants cross-series aggregation must perform it explicitly.
Implementations§
Source§impl<'a> MonitorView<'a>
impl<'a> MonitorView<'a>
Sourcepub fn summary(&self) -> &'a MonitorSummary
pub fn summary(&self) -> &'a MonitorSummary
Aggregate summary statistics: imbalance ratio, nr_running
averages, local DSQ depth, stuck-CPU count, and
optional schedstat / prog-stats deltas. See
MonitorSummary for the full field set.
Sourcepub fn scx_events(&self) -> Option<ScxEventsView<'a>>
pub fn scx_events(&self) -> Option<ScxEventsView<'a>>
SCX event-counter accessor. Returns None when the monitor
ran but event_deltas were not computed (kernel without
event counters, monitoring window too short to compute
first/last deltas) — Option chain matches the source
MonitorSummary::event_deltas: Option<ScxEventDeltas> field.
Callers chain if let Some(evt) = view.scx_events() to
branch on availability without panicking.
Sourcepub fn samples(&self) -> &'a [MonitorSample]
pub fn samples(&self) -> &'a [MonitorSample]
Borrowed per-tick monitor samples. Each
crate::monitor::MonitorSample is one host-side
observation of the guest’s per-CPU runqueue state
(nr_running, local_dsq_depth, rq_clock, optional
event counters). The monitor thread captures these on a
fixed cadence independent of the snapshot bridge’s
freeze-rendezvous captures; samples carry their own
elapsed_ms timestamp for windowing.
Empty when the monitor ran but produced no samples (very
short run, monitor thread exited early). The slot is
always present — MonitorView itself only exists when a
MonitorReport was attached at series construction.
Live caller: crate::assert::build_phase_buckets windows
these samples per phase to compute metrics like
avg_imbalance_ratio that need per-CPU rq.nr_running
(full-class count), which the bridge-captured
crate::scenario::snapshot::Snapshot does NOT expose
(Snapshot carries only scx_rq.nr_running, the SCX-only
subset). The two data axes are complementary: Snapshot for
frozen BPF state at capture instants, MonitorSample for
per-tick observations across the whole window.
Sourcepub fn preemption_threshold_ns(&self) -> u64
pub fn preemption_threshold_ns(&self) -> u64
vCPU-preemption exemption window (ns) for stall detection,
derived from the guest kernel’s CONFIG_HZ at run time. 0
means “derive from a default” — callers folding per-phase
stall counts pass it through to
crate::timeline::compute_metrics so the per-phase predicate
matches the run-level MonitorSummary::stuck_count one.
Trait Implementations§
Source§impl<'a> Clone for MonitorView<'a>
impl<'a> Clone for MonitorView<'a>
Source§fn clone(&self) -> MonitorView<'a>
fn clone(&self) -> MonitorView<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for MonitorView<'a>
impl<'a> Debug for MonitorView<'a>
impl<'a> Copy for MonitorView<'a>
Auto Trait Implementations§
impl<'a> Freeze for MonitorView<'a>
impl<'a> RefUnwindSafe for MonitorView<'a>
impl<'a> Send for MonitorView<'a>
impl<'a> Sync for MonitorView<'a>
impl<'a> Unpin for MonitorView<'a>
impl<'a> UnwindSafe for MonitorView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more