pub struct Snapshot { /* private fields */ }
Expand description
A snapshot of a histogram across a time range.
Implementations§
source§impl Snapshot
impl Snapshot
sourcepub fn range(&self) -> Range<SystemTime>
pub fn range(&self) -> Range<SystemTime>
Return the time range of the snapshot.
sourcepub fn percentiles(
&self,
percentiles: &[f64]
) -> Result<Vec<(f64, Bucket)>, Error>
pub fn percentiles( &self, percentiles: &[f64] ) -> Result<Vec<(f64, Bucket)>, Error>
Return a collection of percentiles from this snapshot.
Each percentile should be in the inclusive range 0.0..=100.0
. For
example, the 50th percentile (median) can be found using 50.0
.
The results will be sorted by the percentile.
sourcepub fn percentile(&self, percentile: f64) -> Result<Bucket, Error>
pub fn percentile(&self, percentile: f64) -> Result<Bucket, Error>
Return a single percentile from this snapshot.
The percentile should be in the inclusive range 0.0..=100.0
. For
example, the 50th percentile (median) can be found using 50.0
.
sourcepub fn downsample(&self, factor: u8) -> Result<Snapshot, Error>
pub fn downsample(&self, factor: u8) -> Result<Snapshot, Error>
Returns a new downsampled histogram with a reduced grouping power.
The new histogram is smaller but with greater relative error. The reduction factor should be smaller than the histogram’s existing grouping power.
sourcepub fn checked_merge(&self, rhs: &Self) -> Result<Self, Error>
pub fn checked_merge(&self, rhs: &Self) -> Result<Self, Error>
Merges two snapshots which cover the same time range.
An error is raised on overflow.
sourcepub fn checked_add(&self, rhs: &Self) -> Result<Self, Error>
pub fn checked_add(&self, rhs: &Self) -> Result<Self, Error>
Appends the provided snapshot onto this snapshot, extending the covered time range and combining the bucket counts.
An error is raised on overflow.
sourcepub fn wrapping_add(&self, rhs: &Self) -> Result<Self, Error>
pub fn wrapping_add(&self, rhs: &Self) -> Result<Self, Error>
Appends the provided snapshot onto this snapshot, extending the covered time range and combining the bucket counts.
Bucket counters will wrap on overflow.
sourcepub fn checked_sub(&self, rhs: &Self) -> Result<Self, Error>
pub fn checked_sub(&self, rhs: &Self) -> Result<Self, Error>
Appends the provided snapshot onto this snapshot, shrinking the covered time range and producing a delta of the bucket counts.
An error is raised on overflow.
sourcepub fn wrapping_sub(&self, rhs: &Self) -> Result<Self, Error>
pub fn wrapping_sub(&self, rhs: &Self) -> Result<Self, Error>
Appends the provided snapshot onto this snapshot, extending the covered time range and combining the bucket counts.
Bucket counters will wrap on overflow.