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§

source§

impl<C: Counter> Recorder<C>

source

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.

source

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.

source

pub fn add<B: Borrow<Histogram<C>>>( &mut self, source: B ) -> Result<(), AdditionError>

source

pub fn add_correct<B: Borrow<Histogram<C>>>( &mut self, source: B, interval: u64 ) -> Result<(), RecordError>

source

pub fn subtract<B: Borrow<Histogram<C>>>( &mut self, subtrahend: B ) -> Result<(), SubtractionError>

source

pub fn record(&mut self, value: u64) -> Result<(), RecordError>

source

pub fn saturating_record(&mut self, value: u64)

source

pub fn record_n(&mut self, value: u64, count: C) -> Result<(), RecordError>

source

pub fn saturating_record_n(&mut self, value: u64, count: C)

source

pub fn record_correct( &mut self, value: u64, interval: u64 ) -> Result<(), RecordError>

source

pub fn record_n_correct( &mut self, value: u64, count: C, interval: u64 ) -> Result<(), RecordError>

Trait Implementations§

source§

impl<C: Counter> AddAssign<u64> for Recorder<C>

source§

fn add_assign(&mut self, value: u64)

Performs the += operation. Read more
source§

impl<C: Counter> Clone for Recorder<C>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Debug + Counter> Debug for Recorder<C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C: Counter> Drop for Recorder<C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for Recorder<C>where C: RefUnwindSafe,

§

impl<C> Send for Recorder<C>where C: Send,

§

impl<C> Sync for Recorder<C>where C: Send + Sync,

§

impl<C> Unpin for Recorder<C>where C: Unpin,

§

impl<C> UnwindSafe for Recorder<C>where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.