pub struct StageTimings { /* private fields */ }Implementations§
Source§impl StageTimings
impl StageTimings
Sourcepub fn start(run: &'static str) -> Self
pub fn start(run: &'static str) -> Self
Begins timing a run. run names it in the reported line.
Sourcepub fn counting(
run: &'static str,
requests: Option<Arc<dyn ProviderRequests>>,
) -> Self
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.
Sourcepub async fn stage<T>(
&mut self,
stage: &'static str,
work: impl Future<Output = T>,
) -> T
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.
Sourcepub fn mark<T>(&mut self, stage: &'static str, work: impl FnOnce() -> T) -> T
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.
Sourcepub fn record(&mut self, stage: &'static str, elapsed: Duration, requests: u64)
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.
Sourcepub fn counted_stages(&self) -> impl Iterator<Item = (&'static str, u64)> + '_
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.
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.
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.