pub struct ForgettingHistogram { /* private fields */ }Expand description
Histogram of interval maxima with exponential forgetting.
Per add: every weight is multiplied by f (Q15, truncating
>> 15), then the value’s bucket gains 1 - f. f ramps as
min(forget, k/(k+1)) over the first intervals so the first few behave as a
plain average (NetEq’s start-weight idea).
Implementations§
Source§impl ForgettingHistogram
impl ForgettingHistogram
Sourcepub fn new(
buckets: u16,
bucket_us: u32,
forget_q15: u16,
quantile_permille: u16,
) -> Self
pub fn new( buckets: u16, bucket_us: u32, forget_q15: u16, quantile_permille: u16, ) -> Self
New histogram. buckets and bucket_us must be non-zero (validated
by the configs; zeros are clamped to 1 here so this never panics).
Sourcepub fn quantile_us(&self) -> u64
pub fn quantile_us(&self) -> u64
Smallest bucket upper edge whose cumulative weight reaches the
quantile (cum * 1000 >= total * q); 0 for an empty histogram.
Sourcepub fn total_weight(&self) -> u64
pub fn total_weight(&self) -> u64
Sum of all weights.
Trait Implementations§
Source§impl Clone for ForgettingHistogram
impl Clone for ForgettingHistogram
Auto Trait Implementations§
impl Freeze for ForgettingHistogram
impl RefUnwindSafe for ForgettingHistogram
impl Send for ForgettingHistogram
impl Sync for ForgettingHistogram
impl Unpin for ForgettingHistogram
impl UnsafeUnpin for ForgettingHistogram
impl UnwindSafe for ForgettingHistogram
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