#[non_exhaustive]pub struct TaskScheduling {
pub scheduled_count: u64,
pub total_scheduled_duration: Duration,
pub long_delay_count: u64,
}Expand description
A snapshot of the cumulative scheduling delay observed by the root instrumented task that the current future is running on.
Obtain one with TaskScheduling::try_current from inside a task that has
been instrumented with TaskMonitor::instrument. Scheduling delay can only
be measured by the root future the runtime schedules, so a future running
within a larger task samples this at two points and reports the difference —
this is exactly what FutureMonitor does to attribute scheduling delay to
a single future.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.scheduled_count: u64The number of times the task was scheduled (woken, then waiting to be polled).
total_scheduled_duration: DurationThe total time the task spent waiting to be polled after being woken.
long_delay_count: u64The number of scheduling delays that crossed the monitor’s long-delay threshold.
Implementations§
Source§impl TaskScheduling
impl TaskScheduling
Sourcepub fn try_current() -> Option<TaskScheduling>
pub fn try_current() -> Option<TaskScheduling>
Reads the cumulative scheduling delay of the task currently being polled.
Returns None when called outside the poll of a future instrumented with
TaskMonitor::instrument.
Trait Implementations§
Source§impl Clone for TaskScheduling
impl Clone for TaskScheduling
Source§fn clone(&self) -> TaskScheduling
fn clone(&self) -> TaskScheduling
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more