pub struct Histogram { /* private fields */ }Implementations§
Source§impl Histogram
impl Histogram
pub fn new(labels: Labels) -> Self
Sourcepub fn with_sigdigs(labels: Labels, sigdigs: u8) -> Self
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).
Sourcepub fn with_sigdigs_from(labels: Labels, component: &Component) -> Self
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
impl Histogram
Sourcepub fn total(&self) -> u64
pub fn total(&self) -> u64
Lifetime (cumulative) observation count — monotonic, unaffected
by snapshot() draining. The cadence capture stamps this onto
HistogramValue::cumulative_count.
Sourcepub fn snapshot(&self) -> HdrHistogram<u64>
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.
Sourcepub fn peek_snapshot(&self) -> HdrHistogram<u64>
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.