ExponentialDecayHistogram

Struct ExponentialDecayHistogram 

Source
pub struct ExponentialDecayHistogram<T = ()> { /* private fields */ }
Expand description

A histogram which exponentially weights in favor of recent values.

See the crate level documentation for more details.

Implementations§

Source§

impl ExponentialDecayHistogram

Source

pub fn new() -> Self

Returns a new histogram with a default configuration.

Source

pub fn builder() -> Builder

Returns a new builder to create a histogram with a custom configuration.

Source

pub fn with_size_and_alpha(size: usize, alpha: f64) -> Self

👎Deprecated: use ExponentialDecayHistogram::builder() instead

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.

Source

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

Inserts a value into the histogram at the current time.

Source

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

Inserts a value into the histogram at the specified time.

§Panics

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

Source§

impl<T> ExponentialDecayHistogram<T>
where T: Clone,

Source

pub fn update_ex(&mut self, value: i64, exemplar: T)

Like Self::update, except that it additionally takes an exemplar.

Source

pub fn update_at_ex(&mut self, time: Instant, value: i64, exemplar: T)

Like Self::update_at, except that it additionally takes an exemplar.

Source

pub fn snapshot(&self) -> Snapshot<T>

Takes a snapshot of the current state of the histogram.

Trait Implementations§

Source§

impl<T: Debug> Debug for ExponentialDecayHistogram<T>

Source§

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

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

impl Default for ExponentialDecayHistogram

Source§

fn default() -> ExponentialDecayHistogram

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V