pub struct HistoryView { /* private fields */ }Expand description
The Time Lens cursor over a ring (§2.1).
Holds no reference to the ring, so it can live in application state next to one and be copied freely. Every method takes the ring it should be resolved against.
Implementations§
Source§impl HistoryView
impl HistoryView
Sourcepub const fn position(self) -> HistoryPosition
pub const fn position(self) -> HistoryPosition
Where the cursor is.
Sourcepub const fn allows_process_actions(self) -> bool
pub const fn allows_process_actions(self) -> bool
Whether process-control actions may be offered.
§2.1 and §15.1 both require process actions to be disabled while inspecting history: the process shown may not exist any more, and its PID may since have been reused. Encoding the rule here keeps every call site from having to remember it.
Sourcepub const fn return_live(&mut self)
pub const fn return_live(&mut self)
Returns to live, the single explicit action §2.1 specifies for L.
Sourcepub fn selected_absolute(self, ring: &HistoryRing) -> Option<u64>
pub fn selected_absolute(self, ring: &HistoryRing) -> Option<u64>
The absolute index the cursor resolves to, clamped into what is retained.
Constant time. A selection whose sample has since been evicted resolves to the oldest retained sample rather than to nothing, so the panel does not blank out while the user is reading it.
Sourcepub fn selected(self, ring: &HistoryRing) -> Option<&HistoricalSample>
pub fn selected(self, ring: &HistoryRing) -> Option<&HistoricalSample>
The selected sample, or the newest one when live.
Sourcepub fn step_back(&mut self, ring: &HistoryRing, steps: usize) -> SeekOutcome
pub fn step_back(&mut self, ring: &HistoryRing, steps: usize) -> SeekOutcome
Moves steps samples towards the past ([, or Shift+[ with
HISTORY_STEP_MULTIPLIER).
Sourcepub fn step_forward(&mut self, ring: &HistoryRing, steps: usize) -> SeekOutcome
pub fn step_forward(&mut self, ring: &HistoryRing, steps: usize) -> SeekOutcome
Moves steps samples towards the present (], or Shift+]).
Sourcepub fn seek_to_offset(
&mut self,
ring: &HistoryRing,
offset: Duration,
) -> SeekOutcome
pub fn seek_to_offset( &mut self, ring: &HistoryRing, offset: Duration, ) -> SeekOutcome
Selects the newest sample at least offset behind the newest one.
Effectively constant time: sample offsets increase monotonically, so this
is a binary search rather than a scan (§21 M4). An offset reaching past
the oldest retained sample clamps there and says so.
Sourcepub fn offset_from_live(self, ring: &HistoryRing) -> Duration
pub fn offset_from_live(self, ring: &HistoryRing) -> Duration
How far behind live the selected sample is.
Computed from monotonic offsets, so a wall-clock change cannot make the header count backwards (§8.1). Zero when live.
Sourcepub fn format_offset(self, ring: &HistoryRing) -> String
pub fn format_offset(self, ring: &HistoryRing) -> String
The header offset text: LIVE, or -00:37 (§2.1, §5.6).
Reports the offset only. §2.1’s third header state, PAUSED, is a UI
state — a paused view that has not been scrubbed sits at offset zero — and
is distinguished with Self::is_live.
Sourcepub fn compare(
self,
ring: &HistoryRing,
metric: HistoryMetric,
baseline: ComparisonBaseline,
) -> Option<MetricComparison>
pub fn compare( self, ring: &HistoryRing, metric: HistoryMetric, baseline: ComparisonBaseline, ) -> Option<MetricComparison>
Compares the selected sample’s metric against an earlier sample (§2.5).
Returns None, never a zero delta, when the baseline does not exist or
when either sample’s input was unavailable. That is what stops a counter
reset from being rendered as a spike (§21 M4) and what honours §26’s
“unavailable is not zero”.
Sourcepub fn comparisons(
self,
ring: &HistoryRing,
metric: HistoryMetric,
) -> MetricComparisons
pub fn comparisons( self, ring: &HistoryRing, metric: HistoryMetric, ) -> MetricComparisons
Both comparisons §2.5 requires, in one call.
Trait Implementations§
Source§impl Clone for HistoryView
impl Clone for HistoryView
Source§fn clone(&self) -> HistoryView
fn clone(&self) -> HistoryView
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more