Struct exponential_decay_histogram::ExponentialDecayHistogram
[−]
[src]
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]
fn new() -> ExponentialDecayHistogram
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.
fn with_size_and_alpha(size: usize, alpha: f64) -> ExponentialDecayHistogram
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.
fn update(&mut self, value: i64)
Inserts a value into the histogram at the current time.
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.
fn snapshot(&self) -> Snapshot
Takes a snapshot of the current state of the histogram.
Trait Implementations
impl Default for ExponentialDecayHistogram
[src]
fn default() -> ExponentialDecayHistogram
Returns the "default value" for a type. Read more