pub struct Histogram {
pub min: f64,
pub max: f64,
pub counts: Vec<u64>,
}Expand description
Equal-width histogram over [min, max]. counts.len() is the bin count.
Fields§
§min: f64Lower edge of the first bin, in raw sample units.
max: f64Upper edge of the final bin, in raw sample units.
counts: Vec<u64>Counts in ascending equal-width bins. Empty or all-zero counts give
Self::min when querying a quantile; their sum may exceed u64::MAX.
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn quantile(&self, p: f64) -> f64
pub fn quantile(&self, p: f64) -> f64
Value at percentile p (0..=100) via linear interpolation on the
cumulative count. Robust to the overview-smoothing approximation
of a sampled overview. Empty / degenerate → min.
Counts may sum beyond u64::MAX; accumulation uses u128 and only
the interpolation converts to f64. The 100th percentile is the upper
edge of the last nonempty bin, excluding any trailing zero-count bins.
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more