Struct hdrhistogram::sync::Recorder
source · [−]pub struct Recorder<C: Counter> { /* private fields */ }
Expand description
A write-only handle to a SyncHistogram
.
This handle allows you to record samples from multiple threads, each with its own Recorder
,
concurrently. Writes to a Recorder
are wait-free and scalable except for when the
SyncHistogram
initiates a phase shift. During a phase shift, the next write on each
associated Recorder
merges its results into a shared Histogram
that is then made
available to the SyncHistogram
once the phase shift completes. Phase shifts should also be
relatively cheap for writers, as they mainly need to perform a channel send on an unbounded,
lock-free channel.
An idle Recorder
will hold up a phase shift indefinitely, or until it times out (is using
SyncHistogram::refresh_timeout
. If a Recorder
will remain idle for extended periods of
time, it should call Recorder::idle
, which will tell the reader not to wait for this
particular writer.
When a Recorder
is dropped, all samples are made visible to the next
SyncHistogram::refresh
.
Implementations
sourceimpl<C: Counter> Recorder<C>
impl<C: Counter> Recorder<C>
sourcepub fn idle(&mut self) -> IdleRecorderGuard<'_, C>
pub fn idle(&mut self) -> IdleRecorderGuard<'_, C>
Call this method if the Recorder will be idle for a while.
Until the returned guard is dropped, the associated SyncHistogram
will not wait for
this recorder on a phase shift.
sourcepub fn into_idle(self) -> IdleRecorder<Self, C>
pub fn into_idle(self) -> IdleRecorder<Self, C>
Mark this Recorder
as inactive.
Until the returned guard is consumed, either by calling IdleRecorder::activate
or by
dropping it, the associated SyncHistogram
will not wait for this recorder on a phase
shift.
sourcepub fn add<B: Borrow<Histogram<C>>>(
&mut self,
source: B
) -> Result<(), AdditionError>
pub fn add<B: Borrow<Histogram<C>>>(
&mut self,
source: B
) -> Result<(), AdditionError>
See Histogram::add
.
sourcepub fn add_correct<B: Borrow<Histogram<C>>>(
&mut self,
source: B,
interval: u64
) -> Result<(), RecordError>
pub fn add_correct<B: Borrow<Histogram<C>>>(
&mut self,
source: B,
interval: u64
) -> Result<(), RecordError>
sourcepub fn subtract<B: Borrow<Histogram<C>>>(
&mut self,
subtrahend: B
) -> Result<(), SubtractionError>
pub fn subtract<B: Borrow<Histogram<C>>>(
&mut self,
subtrahend: B
) -> Result<(), SubtractionError>
See Histogram::subtract
.
sourcepub fn record(&mut self, value: u64) -> Result<(), RecordError>
pub fn record(&mut self, value: u64) -> Result<(), RecordError>
See Histogram::record
.
sourcepub fn saturating_record(&mut self, value: u64)
pub fn saturating_record(&mut self, value: u64)
sourcepub fn record_n(&mut self, value: u64, count: C) -> Result<(), RecordError>
pub fn record_n(&mut self, value: u64, count: C) -> Result<(), RecordError>
See Histogram::record_n
.
sourcepub fn saturating_record_n(&mut self, value: u64, count: C)
pub fn saturating_record_n(&mut self, value: u64, count: C)
sourcepub fn record_correct(
&mut self,
value: u64,
interval: u64
) -> Result<(), RecordError>
pub fn record_correct(
&mut self,
value: u64,
interval: u64
) -> Result<(), RecordError>
sourcepub fn record_n_correct(
&mut self,
value: u64,
count: C,
interval: u64
) -> Result<(), RecordError>
pub fn record_n_correct(
&mut self,
value: u64,
count: C,
interval: u64
) -> Result<(), RecordError>
Trait Implementations
sourceimpl<C: Counter> AddAssign<u64> for Recorder<C>
impl<C: Counter> AddAssign<u64> for Recorder<C>
sourcefn add_assign(&mut self, value: u64)
fn add_assign(&mut self, value: u64)
+=
operation. Read more