[][src]Trait update_rate::RateCounter

pub trait RateCounter {
    fn samples(&self) -> u64;
fn set_samples(&mut self, samples: u64);
fn update(&mut self);
fn rate(&self) -> f64; }

Basic rate counter functionality.

Types which implement RateCounter also implement Display (a string with " Hz") and Debug (including samples as well).

Required methods

fn samples(&self) -> u64

Return the current number of samples the UpdateRateCounter is measuring.

fn set_samples(&mut self, samples: u64)

Set the number of updates which the UpdateRateCounter considers.

Panics

This function may panic if given a samples value equal to 0.

fn update(&mut self)

Updates the struct in place, but requires a mutable binding. Call either this OR update_immut() at the beginning of each cycle of the periodic activity being measured.

fn rate(&self) -> f64

Return the last calculated rate of operation, in Hertz (updates per second).

Loading content...

Implementors

impl RateCounter for DiscreteRateCounter[src]

impl RateCounter for RollingRateCounter[src]

Loading content...