Struct histogram::AtomicHistogram
source · 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.
This is a convenience method that uses Instant::now()
as the time
associated with the observation. If you already have a timestamp, you
may wish to use increment_at
instead.
Auto Trait Implementations§
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