pub struct ExponentialHistogram { /* private fields */ }Expand description
Exponential histogram with configurable scale
Bucket boundaries follow exponential growth: boundary[i] = base^i where base = 2^(2^(-scale))
Implementations§
Source§impl ExponentialHistogram
impl ExponentialHistogram
Sourcepub fn new(scale: i32) -> Self
pub fn new(scale: i32) -> Self
Create a new exponential histogram
§Arguments
scale- Scale parameter (-10 to 20 typical)- scale=0: base=2.0, coarse buckets
- scale=3: base≈1.09, ~8 buckets per doubling (good default)
- scale=5: base≈1.02, ~32 buckets per doubling (high precision)
Sourcepub fn default_scale() -> Self
pub fn default_scale() -> Self
Create with default scale (3 = good balance of precision and memory)
Sourcepub fn merge(&mut self, other: &ExponentialHistogram)
pub fn merge(&mut self, other: &ExponentialHistogram)
Merge another histogram into this one
O(buckets) merge - critical for rollups
Sourcepub fn bucket_count(&self) -> usize
pub fn bucket_count(&self) -> usize
Get number of buckets used
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get memory usage in bytes
Trait Implementations§
Source§impl Clone for ExponentialHistogram
impl Clone for ExponentialHistogram
Source§fn clone(&self) -> ExponentialHistogram
fn clone(&self) -> ExponentialHistogram
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExponentialHistogram
impl Debug for ExponentialHistogram
Auto Trait Implementations§
impl Freeze for ExponentialHistogram
impl RefUnwindSafe for ExponentialHistogram
impl Send for ExponentialHistogram
impl Sync for ExponentialHistogram
impl Unpin for ExponentialHistogram
impl UnsafeUnpin for ExponentialHistogram
impl UnwindSafe for ExponentialHistogram
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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