pub struct Histogram { /* private fields */ }Expand description
A histogram of durations in microseconds.
Power-of-two buckets so that recording is leading_zeros and a fetch-add: no locks, no
allocation, and no comparison chain. The bound this trades away is resolution — a value is
placed within a factor of two — which is the right trade for “is the fold suddenly slow”, and
the wrong one for a billing meter. Nothing here is a billing meter.
Implementations§
Source§impl Histogram
impl Histogram
pub fn record_us(&self, us: u64)
pub fn record(&self, d: Duration)
pub fn count(&self) -> u64
pub fn sum_us(&self) -> u64
pub fn mean_us(&self) -> f64
Sourcepub fn bounds() -> Vec<f64>
pub fn bounds() -> Vec<f64>
The upper bound of each bucket, in microseconds — OTLP’s explicitBounds.
pub fn counts(&self) -> Vec<u64>
Sourcepub fn quantile_us(&self, q: f64) -> u64
pub fn quantile_us(&self, q: f64) -> u64
The bucket at or below which q of the observations fall, as an upper bound in µs.
A bucketed estimate, not an exact quantile: with power-of-two buckets the true value is within a factor of two of what this returns, and saying “p99 is at most 4 ms” is the honest form of the claim.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnwindSafe for Histogram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more