[−][src]Struct metrics_runtime::data::AtomicWindowedHistogram
An atomic windowed histogram.
This histogram provides a windowed view of values that rolls forward over time, dropping old values as they exceed the window of the histogram. Writes into the histogram are lock-free, as well as snapshots of the histogram.
Implementations
impl AtomicWindowedHistogram
[src]
pub fn new(window: Duration, granularity: Duration, clock: Clock) -> Self
[src]
Creates a new AtomicWindowedHistogram
.
Internally, a number of buckets will be created, based on how many times granularity
goes
into window
. As time passes, buckets will be cleared to avoid values older than the
window
duration.
As buckets will hold values represneting a period of time up to granularity
, the
granularity can be lowered or raised to roll values off more precisely, or less precisely,
against the provided clock.
Panics
Panics if granularity
is larger than window
.
pub fn snapshot(&self) -> StreamingIntegers
[src]
Takes a snapshot of the current histogram.
Returns a StreamingIntegers
value, representing all observed values in the
histogram. As writes happen concurrently, along with buckets being cleared, a snapshot is
not guaranteed to have all values present at the time the method was called.
pub fn record(&self, value: u64)
[src]
Records a value to the histogram.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for AtomicWindowedHistogram
impl Send for AtomicWindowedHistogram
impl Sync for AtomicWindowedHistogram
impl Unpin for AtomicWindowedHistogram
impl !UnwindSafe for AtomicWindowedHistogram
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,