pub struct LiveStatistics { /* private fields */ }Expand description
Accumulative stat object that can give your some real time statistics. Uses a fixed-size bucketed histogram for accurate percentile calculations.
Implementations§
Source§impl LiveStatistics
impl LiveStatistics
Sourcepub fn new_with_max(max_value: u64) -> LiveStatistics
pub fn new_with_max(max_value: u64) -> LiveStatistics
Creates a new LiveStatistics instance with a specified maximum value.
This function initializes a LiveStatistics structure with default values
for tracking statistical data, while setting an upper limit for the data
points that the structure tracks.
§Parameters
max_value(u64): The maximum value that can be recorded or tracked.
§Returns
A new instance of LiveStatistics with:
buckets: An array pre-filled with zeros to categorize data points.min_val: Initialized to the maximum possibleu64value to track the minimum correctly.max_val: Initialized to zero.sum: The sum of all data points, initialized to zero.sum_sq: The sum of squares of all data points, initialized to zero.count: The total number of data points, initialized to zero.max_value: The maximum allowable value for data points, set to the providedmax_value.
pub fn min(&self) -> u64
pub fn max(&self) -> u64
pub fn mean(&self) -> f64
pub fn stdev(&self) -> f64
pub fn percentile(&self, percentile: f64) -> u64
pub fn len(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn reset(&mut self)
Trait Implementations§
Source§impl Clone for LiveStatistics
impl Clone for LiveStatistics
Source§fn clone(&self) -> LiveStatistics
fn clone(&self) -> LiveStatistics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LiveStatistics
impl RefUnwindSafe for LiveStatistics
impl Send for LiveStatistics
impl Sync for LiveStatistics
impl Unpin for LiveStatistics
impl UnwindSafe for LiveStatistics
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> 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