pub struct HoldTimer { /* private fields */ }Expand description
Times one actor turn.
§This clock is no longer optional (0.12.0, W1)
Until 0.11.0 the field was #[cfg(feature = "metrics")] and elapsed()
returned Duration::ZERO in a default build: the reading existed only to
feed ActorMetrics::record_hold’s histogram, so a build that did not keep
the histogram had no reason to read a clock.
The chunk loop changed what the reading is for. A chunk’s measured hold is
now the input to the next chunk’s size (connection::next_chunk_size, named
in prose because it is private — D-144), which means it is a control signal
in every build and not an observation in some of them. Left gated, bulk_import would have sized its chunks off
Duration::ZERO — a value that reads as “comfortably under budget” — and
grown every chunk to the ceiling, in exactly the builds nobody was measuring.
So the clock is unconditional and only the histogram is still gated:
record_hold remains a no-op without the feature. What that costs is one
Instant::now() pair per actor turn — tens of nanoseconds against a turn
measured in microseconds at best, and the same reasoning §5.1.5 uses to
decide that a channel hop is free beside a chunk.
It stays a type rather than a bare Instant::now() in the loop because the
ordering guarantee in crate::connection’s Turn is attached to it.
Implementations§
Auto Trait Implementations§
impl Freeze for HoldTimer
impl RefUnwindSafe for HoldTimer
impl Send for HoldTimer
impl Sync for HoldTimer
impl Unpin for HoldTimer
impl UnsafeUnpin for HoldTimer
impl UnwindSafe for HoldTimer
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request