Skip to main content

Window

Struct Window 

Source
pub struct Window { /* private fields */ }
Expand description

a histogram over the last slots spans of time

Implementations§

Source§

impl Window

Source

pub fn new(slots: usize, span: u64) -> Window

slots slots of span time units each (at least one of each)

Source

pub fn with_bits(slots: usize, span: u64, bits: u8) -> Window

Source

pub fn slots(&self) -> usize

Source

pub fn bytes(&self) -> usize

the heap memory it holds: its slots and their histograms (none before the first value)

Source

pub fn span(&self) -> u64

Source

pub fn record(&mut self, t: u64, v: u64) -> bool

counts v at time t; false when t lies before the window that ends at the newest time recorded so far

Source

pub fn record_n(&mut self, t: u64, v: u64, n: u32) -> bool

Source

pub fn hist(&self, t: u64) -> Hist

everything in the window at time t as one histogram

Source

pub fn hist_between(&self, from: u64, to: u64) -> Hist

the slots that start in [from, to) as one histogram: what was recorded between two times, to the resolution of the slots; slots the ring no longer holds are left out

Source

pub fn count(&self, t: u64) -> u64

Source

pub fn sum(&self, t: u64) -> u128

Source

pub fn mean(&self, t: u64) -> Option<u64>

Source

pub fn min(&self, t: u64) -> Option<u64>

Source

pub fn max(&self, t: u64) -> Option<u64>

Source

pub fn quantile(&self, t: u64, per_mille: u32) -> Option<u64>

Source

pub fn p50(&self, t: u64) -> Option<u64>

Source

pub fn p95(&self, t: u64) -> Option<u64>

Source

pub fn p99(&self, t: u64) -> Option<u64>

Source

pub fn per_slot(&self, t: u64, per_mille: u32) -> Vec<(u64, u64, Option<u64>)>

one value per slot of the window at time t, oldest first: (start time of the slot, count, quantile or None when the slot is empty)

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Window

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Window

Source§

impl PartialEq for Window

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Window

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.