pub struct RunState {Show 34 fields
pub workload_file: String,
pub scenario_name: String,
pub adapter: String,
pub started_at: Instant,
pub started_at_utc: SystemTime,
pub profiler: String,
pub limit: String,
pub tree: SceneTree,
pub summaries: HashMap<SceneNodeId, PhaseSummary>,
pub sysmon: Option<SysmonSample>,
pub phase_session_elapsed: HashMap<SceneNodeId, f64>,
pub phase_session_started: HashMap<SceneNodeId, f64>,
pub phase_ops: HashMap<SceneNodeId, Vec<OpEntry>>,
pub phases: Vec<PhaseEntry>,
pub expected_total_phases: usize,
pub active_phases: HashMap<PhaseKey, ActivePhase>,
pub min_nanos: u64,
pub p50_nanos: u64,
pub p90_nanos: u64,
pub p99_nanos: u64,
pub p999_nanos: u64,
pub max_nanos: u64,
pub log_messages: Vec<LogEntry>,
pub log_seq_total: u64,
pub ops_history: Vec<f64>,
pub rows_history: Vec<f64>,
pub rows_sparkline_label: Option<String>,
pub max_history: Vec<u64>,
pub min_history: Vec<u64>,
pub p50_history: Vec<u64>,
pub p90_history: Vec<u64>,
pub p99_history: Vec<u64>,
pub p999_history: Vec<u64>,
pub finished: bool,
}Expand description
Top-level run state shared between executor and TUI.
Fields§
§workload_file: String§scenario_name: String§adapter: String§started_at: Instant§started_at_utc: SystemTimeWall-clock at session start. Captured alongside the
monotonic started_at so the failure-dump path can
(a) print a UTC header naming the absolute moment
0.00000 corresponds to, and (b) compute per-entry
deltas against it. The monotonic started_at stays
authoritative for elapsed-time comparisons; this one
is for human-readable display only.
profiler: String§limit: String§tree: SceneTreeCanonical scene tree: every concrete phase + scope header
wired by parent / children pointers. The pre-mapped
scenario shape lands here once via scenario_pre_mapped;
lifecycle callbacks (set_phase_running / _completed /
_failed) mutate node statuses in place.
summaries: HashMap<SceneNodeId, PhaseSummary>Heavy per-phase metrics produced at completion. Keyed by
SceneNodeId so scope-level renderers can also look up
child summaries cheaply. Side-map (rather than baked into
SceneNode) so the tree itself stays small / serializable.
sysmon: Option<SysmonSample>Latest sysmon sample window (host utilization), when the session-level
sampler is enabled. Refreshed every sample interval; None when the
sampler is off, so display surfaces add nothing.
phase_session_elapsed: HashMap<SceneNodeId, f64>Side-map of the session clock reading captured when each leaf
reached a terminal state (completed/failed), keyed by
SceneNodeId. Mirrors summaries; feeds PhaseEntry::session_elapsed
so a finished row persists the session time at which it finished.
phase_session_started: HashMap<SceneNodeId, f64>Session clock at each phase’s Running transition — see
PhaseEntry::session_started. Keyed like
phase_session_elapsed.
phase_ops: HashMap<SceneNodeId, Vec<OpEntry>>Op-level status leaves keyed by their parent phase’s SceneNodeId,
in arrival order. Populated only for ops declaring readout: visible
(via the readout wrapper’s op-lifecycle events); empty otherwise, so
there is no cost for the common case.
phases: Vec<PhaseEntry>Denormalized DFS view of tree in display order, kept in
sync by rebuild_phases() after every tree mutation. Read
by the renderer hot paths via state.phases indexing —
rebuilding once per mutation beats walking the tree per
frame, and the cost is negligible (mutations are a handful
per phase lifecycle, not per-op).
expected_total_phases: usizePhase-count denominator from the pre-map walk —
pinned at install_tree time and never mutated by
runtime phase materialization. The renderer’s X/N
margin display reads this as the stable Y, so an
operator watching the progress sees a fixed total
rather than one that drifts upward as for_each
expansion lands new phases at runtime.
When the runtime materializes more phases than the
pre-map enumerated (param-driven for_each whose iter
source the structural walker couldn’t resolve), the
numerator can exceed expected_total_phases — that’s
the honest signal that the planning walk under-counted,
surfaced as N/Y with N > Y rather than papered
over by a moving denominator.
active_phases: HashMap<PhaseKey, ActivePhase>Every phase currently in flight, keyed by (name, labels).
Empty between phases. Multi-phase scenarios (stanza-level
parallelism, multi-activity sessions) populate more than
one entry. Most read sites today still assume at most one
running phase — those use Self::first_active as a
compatibility shim over the map.
min_nanos: u64Latency percentiles from last capture (nanoseconds).
p50_nanos: u64§p90_nanos: u64§p99_nanos: u64§p999_nanos: u64§max_nanos: u64§log_messages: Vec<LogEntry>Log ring buffer (last 200 entries). Displayed in TUI log panel.
log_seq_total: u64Monotonic sequence of every push to log_messages, never
decremented. The ring keeps only the last 200 entries; this
counter keeps growing forever so crate::display_sink
implementations can detect “new entries since I last
drained” without wrestling the ring. A renderer remembers
the last value it printed; on each tick it looks at
log_seq_total - last_printed and reads that many entries
off the tail of log_messages. Overflow (renderer slower
than 200 events / poll) is detectable as delta > log_messages.len() and the renderer can emit a “dropped N
log lines” notice.
ops_history: Vec<f64>Rolling ops/s history for sparkline (last 120 samples).
rows_history: Vec<f64>Rolling secondary-counter history for sparkline. The counter
sampled is whichever adapter counter is first in
active.adapter_counters — only populated when an adapter
actually reports one, so it’s never a hardcoded “rows”.
rows_sparkline_label: Option<String>Display label for the secondary sparkline (e.g. “rows/s” or
“inserted/s”). None when no adapter counter is being tracked.
max_history: Vec<u64>Rolling max-latency history (nanoseconds). Sampled every drain tick (~250ms). Used by the latency panel to mark windowed peaks (e.g., “last 5s”, “last 10s”) with cross-bar glyphs.
min_history: Vec<u64>Rolling per-percentile histories, one push per frame delivered
by the metrics scheduler (≈1 Hz). Fed to the time-series latency
view and the short-window (5s / 15s max) variants on the
barchart. Bounded at HISTORY_CAP so memory doesn’t grow with
the run — for true lifetime statistics use the *_lifetime
aggregates below.
p50_history: Vec<u64>§p90_history: Vec<u64>§p99_history: Vec<u64>§p999_history: Vec<u64>§finished: boolSet to true when the run is complete.
Implementations§
Source§impl RunState
impl RunState
pub fn new(workload_file: &str, scenario_name: &str, adapter: &str) -> Self
Sourcepub fn first_active(&self) -> Option<&ActivePhase>
pub fn first_active(&self) -> Option<&ActivePhase>
Borrow any one currently-running phase, if any exist.
Compatibility shim for call sites that still assume a single
running phase (ETA display, header labels, …). Multi-phase
call sites should iterate Self::active_phases directly.
Sourcepub fn active_phase(&self, name: &str, labels: &str) -> Option<&ActivePhase>
pub fn active_phase(&self, name: &str, labels: &str) -> Option<&ActivePhase>
Borrow the active-phase entry matching a specific (name, labels) pair — used when the caller already knows which phase row it’s rendering detail for.
Sourcepub fn active_phase_mut(
&mut self,
exec_id: u64,
name: &str,
labels: &str,
) -> Option<&mut ActivePhase>
pub fn active_phase_mut( &mut self, exec_id: u64, name: &str, labels: &str, ) -> Option<&mut ActivePhase>
Mutable borrow of the active-phase entry for a specific (exec_id, name, labels) key. Used by the observer’s progress callback to update in place.
Sourcepub fn push_log(&mut self, severity: LogSeverity, message: String)
pub fn push_log(&mut self, severity: LogSeverity, message: String)
Push a log entry to the ring buffer (capped at 200).
log_seq_total increments unconditionally so display sinks
can detect new-since-last-drain without inspecting the ring.
Sourcepub fn push_log_tagged(
&mut self,
severity: LogSeverity,
tag: EventTag,
message: String,
)
pub fn push_log_tagged( &mut self, severity: LogSeverity, tag: EventTag, message: String, )
Self::push_log with an explicit EventTag. The tag
travels with the entry into the ring so the terminal sink
can derive its filtering (boundary-attached renders out of
scrollback) from the axes at drain time.
Sourcepub fn push_log_entry(&mut self, entry: LogEntry) -> u64
pub fn push_log_entry(&mut self, entry: LogEntry) -> u64
Push a pre-built LogEntry into the ring and return the
new Self::log_seq_total it was assigned. The ring stays
bounded (last 200) — it backs the inspector log view, the
TUI log panel, and the post-run failure dump, none of which
need unbounded history. The durable, no-drop scrollback
stream is a separate channel the actor feeds in lock-step
with this push (see
crate::run_state_actor::spawn_run_state_actor); the
returned seq tags the matching stream item so a
terminal-mode sink can skip lines already emitted elsewhere
(pre-handoff stderr, or a prior sink’s scrollback).
Sourcepub fn push_ops_sample(&mut self, ops_per_sec: f64)
pub fn push_ops_sample(&mut self, ops_per_sec: f64)
Push an ops/s sample to the sparkline history (capped at 120).
Sourcepub fn push_rows_sample(&mut self, rows_per_sec: f64)
pub fn push_rows_sample(&mut self, rows_per_sec: f64)
Push a rows/s sample to the sparkline history.
Sourcepub fn install_tree(&mut self, tree: SceneTree)
pub fn install_tree(&mut self, tree: SceneTree)
Replace the scene tree wholesale — called once from the
observer’s scenario_pre_mapped hook with the fully
resolved pre-map. Existing summaries are dropped (they
never apply across pre-maps).
Sourcepub fn add_phase(&mut self, name: &str, labels: &str, _depth: usize)
pub fn add_phase(&mut self, name: &str, labels: &str, _depth: usize)
Add a pending phase to the tree at the synthetic root — fallback path for sources that don’t pre-map.
Sourcepub fn add_scope(&mut self, label: &str, _depth: usize)
pub fn add_scope(&mut self, label: &str, _depth: usize)
Add a visual grouping header at the synthetic root.
Sourcepub fn set_phase_running(
&mut self,
scene_node_id: SceneNodeId,
name: &str,
labels: &str,
op_count: usize,
)
pub fn set_phase_running( &mut self, scene_node_id: SceneNodeId, name: &str, labels: &str, op_count: usize, )
Mark a phase as running, keyed by the dispatch-time
scene_node_id (SRD-100 P1c). Pre-mapped phases flip their
own node directly; a phase the pre-map never enumerated is
pushed dynamically so it still gets a tree slot.
Sourcepub fn final_op_leaves(&self, name: &str, labels: &str) -> Vec<(String, String)>
pub fn final_op_leaves(&self, name: &str, labels: &str) -> Vec<(String, String)>
Mark a phase as completed and attach a metrics summary,
keyed by the dispatch-time scene_node_id (SRD-100 P1c).
Final per-op timing leaves for a phase at its completion —
the durable form of the footer’s SRD-63 op rows, preserved
into scrollback under the ✓ outcome block. Terminal ops carry
their execution time and session finish-stamp; an op still
mid-flight at phase end (a cancelled daemon probe) shows —.
Empty when the phase declared no readout: visible ops.
Returns (line, duration_cell) pairs: the leaf body carries
icon · name · [i/N] · @ session-stamp; the node’s own
execution DURATION is the second element, rendered as the
leaf row’s default gutter cell (SRD-92: a visible node with
no declared gutter gets its execution time as the cell —
the scannable per-step time ledger). Single placement: the
duration appears only in the cell, the session stamp only
in the body.
pub fn set_phase_completed( &mut self, scene_node_id: SceneNodeId, name: &str, labels: &str, duration_secs: f64, summary: PhaseSummary, )
Sourcepub fn set_phase_failed(
&mut self,
scene_node_id: SceneNodeId,
name: &str,
labels: &str,
error: &str,
)
pub fn set_phase_failed( &mut self, scene_node_id: SceneNodeId, name: &str, labels: &str, error: &str, )
Mark a phase as failed, keyed by the dispatch-time
scene_node_id (SRD-100 P1c).
Sourcepub fn op_starting(&mut self, parent: SceneNodeId, name: &str)
pub fn op_starting(&mut self, parent: SceneNodeId, name: &str)
An op-level status leaf started (SRD-63). Creates or re-arms the entry (keyed by name within the parent phase) as Running with a fresh timer.
Sourcepub fn op_measure(&mut self, parent: SceneNodeId, op_name: &str, text: &str)
pub fn op_measure(&mut self, parent: SceneNodeId, op_name: &str, text: &str)
An op-level status leaf completed; persists its execution time and the session clock at completion. Record an op’s key measurable. Arrives just before completion, so the leaf row has it the moment it settles.
pub fn op_completed( &mut self, parent: SceneNodeId, name: &str, duration_secs: f64, )
Sourcepub fn op_failed(&mut self, parent: SceneNodeId, name: &str, error: &str)
pub fn op_failed(&mut self, parent: SceneNodeId, name: &str, error: &str)
An op-level status leaf failed; freezes its elapsed time and session clock.
Sourcepub fn elapsed_secs(&self) -> f64
pub fn elapsed_secs(&self) -> f64
Elapsed time since run started.
Sourcepub fn margin_body_stamp(&self) -> String
pub fn margin_body_stamp(&self) -> String
The uncolored status-margin body (session · [n/N] · leaf)
for the CURRENT state. The run-state actor stamps this onto
every scrollback line at Log-command processing time, so a
line’s gutter is computed from exactly the state that
preceded it in the command stream — it can never disagree
with the event the line describes (the old render-time
margin was one snapshot for a whole drained batch, and raced
the very transitions the lines reported).
Sourcepub fn total_phases(&self) -> usize
pub fn total_phases(&self) -> usize
Total Phase entries in the pre-mapped scene tree —
denominator for the [N/total] and phase X/Y displays.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RunState
impl !UnwindSafe for RunState
impl Freeze for RunState
impl Send for RunState
impl Sync for RunState
impl Unpin for RunState
impl UnsafeUnpin for RunState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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