Skip to main content

Histogram

Struct Histogram 

Source
pub struct Histogram { /* private fields */ }

Implementations§

Source§

impl Histogram

Source

pub fn new(labels: Labels) -> Self

Source

pub fn with_sigdigs(labels: Labels, sigdigs: u8) -> Self

Construct with an explicit HDR significant-digits precision. Use this from a call site that already knows the desired precision (e.g. the runner that has already resolved HDR_SIGDIGS_PROP up the component tree).

Source

pub fn with_sigdigs_from(labels: Labels, component: &Component) -> Self

Construct from a component, walking up the tree to find the configured HDR_SIGDIGS_PROP property. Falls back to DEFAULT_HDR_SIGDIGS if no ancestor declares it. SRD 40 §“HDR significant digits — subtree-scoped setting”.

Source§

impl Histogram

Source

pub fn record(&self, value: u64)

Record a value (typically nanoseconds).

Source

pub fn total(&self) -> u64

Lifetime (cumulative) observation count — monotonic, unaffected by snapshot() draining. The cadence capture stamps this onto HistogramValue::cumulative_count.

Source

pub fn snapshot(&self) -> HdrHistogram<u64>

Swap out the current histogram and return the delta.

The returned histogram contains all data since the last snapshot() call. The internal histogram is reset.

Source

pub fn peek_snapshot(&self) -> HdrHistogram<u64>

Produce a snapshot by CLONING the current histogram rather than swapping it out. The instrument keeps accumulating against the same state — no reservoir disturbance — so consumers reading “now” values between reporter ticks don’t steal samples from the next delta snapshot.

Cost: one HDR histogram clone (~200 KiB at 3-significant-digit precision over a 1-hour range). Acceptable for occasional calls — not intended for the per-sample hot path.

Source

pub fn labels(&self) -> &Labels

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.