pub struct ElapsedComputeFuture<T> { /* private fields */ }Expand description
Wraps any Future and accumulates the wall-clock time spent inside
each Future::poll call into elapsed_compute. Everything that
executes synchronously within a poll() scope is measured — including
CPU-bound work, memory copies, and any blocking the future performs
before returning. Time between polls (when the runtime has suspended the
future waiting for I/O, a channel, or a waker) is not measured.
For futures that mix synchronous CPU work with async I/O this gives a
good approximation of CPU time: async I/O causes the future to yield
(Poll::Pending), so the I/O latency is excluded automatically.
Note: uses pin-project rather than pin-project-lite in order to
support PinnedDrop, which ensures accumulated time is flushed even
if the future is cancelled (dropped before completion).
Trait Implementations§
Source§impl<T> Drop for ElapsedComputeFuture<T>
impl<T> Drop for ElapsedComputeFuture<T>
Source§impl<O, F: Future<Output = O>> Future for ElapsedComputeFuture<F>
impl<O, F: Future<Output = O>> Future for ElapsedComputeFuture<F>
impl<'pin, T> Unpin for ElapsedComputeFuture<T>where
PinnedFieldsOf<__ElapsedComputeFuture<'pin, T>>: Unpin,
Auto Trait Implementations§
impl<T> Freeze for ElapsedComputeFuture<T>where
T: Freeze,
impl<T> RefUnwindSafe for ElapsedComputeFuture<T>where
T: RefUnwindSafe,
impl<T> Send for ElapsedComputeFuture<T>where
T: Send,
impl<T> Sync for ElapsedComputeFuture<T>where
T: Sync,
impl<T> UnsafeUnpin for ElapsedComputeFuture<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ElapsedComputeFuture<T>where
T: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<O, F> ElapsedComputeFutureExt for Fwhere
F: Future<Output = O>,
impl<O, F> ElapsedComputeFutureExt for Fwhere
F: Future<Output = O>,
Source§fn with_elapsed_compute(self, elapsed_compute: Time) -> ElapsedComputeFuture<F> ⓘ
fn with_elapsed_compute(self, elapsed_compute: Time) -> ElapsedComputeFuture<F> ⓘ
Future::poll
call is accumulated into elapsed_compute. See ElapsedComputeFuture
for a full description of what is and is not measured.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more