pub struct AtomicHistogram { /* private fields */ }
Expand description
A histogram that uses atomic 64bit counters for each bucket.
Unlike the non-atomic variant, it cannot be used directly to report percentiles. Instead, a snapshot must be taken which captures the state of the histogram at a point in time.
Implementations§
Source§impl AtomicHistogram
impl AtomicHistogram
Sourcepub fn new(p: u8, n: u8) -> Result<Self, Error>
pub fn new(p: u8, n: u8) -> Result<Self, Error>
Construct a new atomic histogram from the provided parameters. See the
documentation for crate::Config
to understand their meaning.
Sourcepub fn with_config(config: &Config) -> Self
pub fn with_config(config: &Config) -> Self
Creates a new atomic histogram using a provided crate::Config
.
Sourcepub fn increment(&self, value: u64) -> Result<(), Error>
pub fn increment(&self, value: u64) -> Result<(), Error>
Increment the bucket that contains the value by one.
Sourcepub fn add(&self, value: u64, count: u64) -> Result<(), Error>
pub fn add(&self, value: u64, count: u64) -> Result<(), Error>
Increment the bucket that contains the value by some count.
Sourcepub fn drain(&self) -> Histogram
pub fn drain(&self) -> Histogram
Drains the bucket values into a new Histogram
Unlike load
, this method will reset all bucket values to zero. This uses AtomicU64::swap
and is not available
on platforms where AtomicU64::swap
is not available.
Auto Trait Implementations§
impl Freeze for AtomicHistogram
impl RefUnwindSafe for AtomicHistogram
impl Send for AtomicHistogram
impl Sync for AtomicHistogram
impl Unpin for AtomicHistogram
impl UnwindSafe for AtomicHistogram
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
Mutably borrows from an owned value. Read more