[][src]Struct exponential_decay_histogram::ExponentialDecayHistogram

pub struct ExponentialDecayHistogram { /* fields omitted */ }

A histogram which exponentially weights in favor of recent values.

See the crate level documentation for more details.

Methods

impl ExponentialDecayHistogram[src]

pub fn new() -> ExponentialDecayHistogram[src]

Returns a new histogram with a default configuration.

The default size is 1028, which offers a 99.9% confidence level with a 5% margin of error. The default alpha is 0.015, which heavily biases towards the last 5 minutes of values.

pub fn with_size_and_alpha(size: usize, alpha: f64) -> ExponentialDecayHistogram[src]

Returns a new histogram configured with the specified size and alpha.

size specifies the number of values stored in the histogram. A larger size will provide more accurate statistics, but with a higher memory overhead.

alpha specifies the exponential decay factor. A larger factor biases the histogram towards newer values.

Panics

Panics if size is zero.

pub fn update(&mut self, value: i64)[src]

Inserts a value into the histogram at the current time.

pub fn update_at(&mut self, time: Instant, value: i64)[src]

Inserts a value into the histogram at the specified time.

Panics

May panic if values are inserted at non-monotonically increasing times.

pub fn snapshot(&self) -> Snapshot[src]

Takes a snapshot of the current state of the histogram.

Trait Implementations

impl Default for ExponentialDecayHistogram[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,