pub struct RwLockHistogram { /* private fields */ }
Expand description

A histogram that uses free-running non-atomic counters to track the distribution of values. They are only useful for bulk recording of values and producing [crate::Snapshot]s of the histogram state which can then be used for reporting.

The AtomicHistogram should be preferred when individual events are being recorded. The RwLockHistogram should be preferred when bulk-updating the histogram from pre-aggregated data with a compatible layout.

Implementations§

source§

impl RwLockHistogram

source

pub const fn new(grouping_power: u8, max_value_power: u8) -> Self

Create a new ::histogram::AtomicHistogram with the given parameters.

§Panics

This will panic if the grouping_power and max_value_power do not adhere to the following constraints:

  • max_value_power must be in the range 1..=64
  • grouping_power must be in the range 0..=(max_value_power - 1)
source

pub fn update_from(&self, data: &[u64]) -> Result<(), Error>

Updates the histogram counts from raw data.

source

pub fn config(&self) -> Config

source

pub fn load(&self) -> Option<Histogram>

Loads and returns the histogram. Returns None if the histogram has never been incremented.

Trait Implementations§

source§

impl Metric for RwLockHistogram

source§

fn as_any(&self) -> Option<&dyn Any>

Get the current metric as an Any instance. This is meant to allow custom processing for known metric types.
source§

fn value(&self) -> Option<Value<'_>>

Get the value of the current metric, should it be enabled. Read more
source§

fn is_enabled(&self) -> bool

Indicate whether this metric has been set up. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.