Skip to main content

StageTimings

Struct StageTimings 

Source
pub struct StageTimings { /* private fields */ }

Implementations§

Source§

impl StageTimings

Source

pub fn start(run: &'static str) -> Self

Begins timing a run. run names it in the reported line.

Source

pub fn counting( run: &'static str, requests: Option<Arc<dyn ProviderRequests>>, ) -> Self

Begins timing a run that asks its storage to count the provider operations each stage issues.

requests is what the storage answered: None from storage nobody wrapped for counting, and such a run reports the line start would have. Every run with storage in reach comes through here rather than choosing between the two constructors itself, because whether counting is on is the storage’s answer, not the run’s.

The reported line carries the run’s own total beside its wall time, so operations made outside every named stage stay visible as the difference — the same way unnamed time already does.

The counter belongs to the provider, not to this run, so a second run working the same home at the same time is counted into whichever stage is open — exactly the way it is already counted into that stage’s wall time. Both numbers describe what the home did while the stage was open, which is the honest reading of a shared home.

Source

pub async fn stage<T>( &mut self, stage: &'static str, work: impl Future<Output = T>, ) -> T

Awaits work as the named stage, adding its elapsed time and the operations it issued to that stage’s totals for this run.

Source

pub fn mark<T>(&mut self, stage: &'static str, work: impl FnOnce() -> T) -> T

Time one blocking step. stage covers work that awaits; plenty of what dominates a run — parsing and signature checks over a carried history — never awaits, and is invisible without this.

Source

pub fn record(&mut self, stage: &'static str, elapsed: Duration, requests: u64)

Adds time and operations a caller measured itself, for work whose split is only visible from inside it — a stream walk knows how much of its wait was head slots and how much was the commits behind them, and how many reads each took; the pull only sees the total.

Source

pub fn counted_stages(&self) -> impl Iterator<Item = (&'static str, u64)> + '_

Each stage this run has accumulated and the operations charged to it, in first-seen order — the same content the reported line renders, for a test that has to see where a choreography’s operations landed rather than read them back off a log.

Source

pub fn report(self)

Reports the breakdown. Called on every exit path, including failures — a cycle that died halfway is exactly the one whose stage timings matter.

Trait Implementations§

Source§

impl Drop for StageTimings

A run that is dropped without reporting was cancelled — its future was abandoned partway, which no ? and no explicit call at the end of a function can catch. A device join whose pairing code expires mid-install is exactly that, and it used to leave no trace at all: the stages it had reached died with the future. Reporting from the drop makes the abandoned run say how far it got.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more