Skip to main content

Activity

Struct Activity 

Source
pub struct Activity { /* private fields */ }
Expand description

What a spawned command has been doing, shared between the reader threads that see its bytes, the CPU sampler, the wait loop that judges it, and the progress displays. Every field is an atomic offset from base, so the 80 ms repaint and the 25 ms wait loop read it without a lock.

Two clocks, kept apart on purpose: last_out is when it last WROTE (what the messages report as “last output”), last_busy is the start of the last window in which its process tree did measurable CPU work. The kill decision uses the later of the two (Activity::still_for).

Implementations§

Source§

impl Activity

Source

pub fn new() -> Arc<Activity> ⓘ

Source

pub fn last_wait_kind(&self) -> Option<WaitKind>

What the most recent declared wait, ended or not, was for.

Source

pub fn stderr_line(&self, raw: &str)

One complete stderr line arrived. A wait marker starts a declared wait, or continues the one in progress (cargo prints package cache and then build directory; the budget covers the run of them, not each); any other line ends it. The line is kept for the messages.

Source

pub fn end_wait(&self)

The tool wrote something that is not a wait marker: whatever wait was in progress is over, and its length is banked for the note.

Source

pub fn waiting(&self) -> Option<(WaitKind, Duration)>

The declared wait in progress, and how long it has lasted.

Source

pub fn waited_total(&self) -> Duration

Time spent in declared waits that have ended, plus the one in progress: what a passing check waited for in total.

Source

pub fn last_line(&self) -> Option<String>

The last non-empty stderr line, if any.

Source

pub fn set_load(&self, budget_secs: u64, load: Load, factor_milli: u32)

The wait loop read the host’s load and is applying budget_secs.

Source

pub fn load_scale(&self) -> Option<(u64, Load, u32)>

The load-stretched budget in force, with the load behind it, when the host’s load stretched it at all.

Source

pub fn touch(&self)

It wrote something.

Source

pub fn quiet_for(&self) -> Duration

How long since it last wrote a byte — the true output silence, what the displays report as “last output”.

Source

pub fn silence_for(&self) -> Duration

The silence the clock counts: zero while the command is in a declared wait (it has said what it is doing), the output silence otherwise. What Activity::still_for and the sampler’s start gate read; the displays keep Activity::quiet_for.

Source

pub fn still_for(&self) -> Duration

How long it has been BOTH silent and idle on CPU — the number the silence budget is judged against. Equals Activity::silence_for whenever CPU is not sampled.

Source

pub fn cpu_state(&self) -> CpuState

Source

pub fn fresh_rate(&self) -> Option<u32>

The last measured rate in thousandths of a core, while it is fresh: None once two sampling intervals have passed without a complete window, so a display never keeps showing “busy” on stale data.

Source

pub fn verdict(&self) -> CpuVerdict

What the CPU side can honestly say at a kill. “Measured idle” names the unbroken span of complete measurements it rests on — sampling starts only after a stretch of silence, so that span is always shorter than the silence itself, and nothing is claimed about the rest.

Source

pub fn record(&self, obs: Observation, at: Instant, interval: Duration)

Feed one sampler observation in. interval is the sampling period, kept so displays can tell a fresh rate from a stale one.

Source

pub fn enable_cpu(&self)

Sampling is on for this command.

Source

pub fn gate(&self) -> CpuGate

Which silence budget applies right now, from what the sampler can claim: see CpuGate.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.