Aggregated

Enum Aggregated 

Source
#[non_exhaustive]
pub enum Aggregated { Sum(u64), Max(u64), OrdinalRange { min: i64, max: i64, }, Mode { tallies: BTreeMap<String, usize>, total: usize, }, Affinity(AffinitySummary), Absent, }
Expand description

Aggregated metric value for a single super::ThreadGroup.

Carries both a numeric projection (used for delta math and sort order) and a display form. Not every rule produces a numeric — the categorical rules (super::AggRule::Mode / super::AggRule::ModeChar / super::AggRule::ModeBool) aggregate to a string, which has no scalar — so the numeric is optional and rows without one fall to the bottom of the default sort.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Sum(u64)

Group-wide sum produced by the super::AggRule::SumCount / super::AggRule::SumNs / super::AggRule::SumTicks / super::AggRule::SumBytes rules. The dispatch unwraps the typed newtype’s inner u64 after the crate::metric_types::Summable::sum_across reduction; storage stays u64 to preserve full precision across the entire schedstats / byte / tick range with no lossy cast at aggregation time. The render-time auto-scale ladder is derived from the typed accessor newtype via super::AggRule::ladder — there is no separate unit tag on the metric def.

§

Max(u64)

Group-wide maximum produced by the super::AggRule::MaxPeak / super::AggRule::MaxGaugeNs / super::AggRule::MaxGaugeCount rules. Distinct variant from Sum so a downstream consumer that wants to surface “the worst single thread” rather than “the summed-across-threads value” can match without name- matching against the metric registry. Storage is u64 to preserve full ns precision across the entire schedstats range (no as f64 lossy cast at aggregation time).

§

OrdinalRange

Group-wide [min, max] interval produced by the super::AggRule::RangeI32 / super::AggRule::RangeU32 rules. Both bounds widen to i64 at the dispatch boundary (i64::from(OrdinalI32.0) / i64::from(OrdinalU32.0)) — OrdinalI32 carries a signed kernel-side range (nice includes negative values) and OrdinalU32 fits into i64 losslessly, so a single signed scalar represents both ordinal widths without losing the sign from OrdinalI32 or wrapping the magnitude from OrdinalU32. Delta math takes the midpoint ((min + max) / 2) so a one-sided shift surfaces in the rendered delta column.

Fields

§min: i64
§max: i64
§

Mode

Categorical aggregate carrying per-value counts across the bucket. tallies maps each observed value to its occurrence count; total is the bucket size (count of every contributor, including any empty-string fallbacks). The mode (most-frequent value) is derived on demand via Aggregated::mode_value / Aggregated::mode_count so cross-bucket merges (N:1 fudge) compose correctly: unioning two buckets’ tallies gives the true cross-bucket frequency for each value, not just the per-bucket max-count. Empty buckets surface as tallies: empty, total: bucket_size; the renderer handles the empty case by emitting ~ in place of the mode value.

Fields

§total: usize
§

Affinity(AffinitySummary)

§

Absent

The metric’s capture-gated family was NOT measured for any thread in the group — the taskstats genetlink query failed for every thread (the query-level ThreadState::taskstats_measured flag is false: CONFIG_TASKSTATS off / no CAP_NET_ADMIN / query raced exit), or — for the jemalloc byte counters — no thread’s per-thread probe READ succeeded (non-jemalloc process, probe could not attach, or the read failed) — distinct from a measured zero. (A sub-family disabled while the query still succeeds — e.g. CONFIG_TASK_XACCT off, or the kernel.task_delayacct sysctl off, with the other family on — now IS Absent: the measured predicate ANDs the per-thread query-Ok with the per-sub-family active flag baked from host probes. See the taskstats_measured field doc.) Produced by super::aggregate’s caller when the family has a measured predicate, the bucket is non-empty, and no contributing thread captured it. numeric() returns None, so a derived metric consuming it (e.g. total_offcpu_delay_ns, live_heap_estimate) short-circuits to absent rather than computing from a sentinel 0, and the renderer prints “-” rather than “0”. A MEASURED zero stays Sum(0) and renders “0”.

Implementations§

Source§

impl Aggregated

Source

pub fn numeric(&self) -> Option<f64>

Scalar projection for delta math. None when the rule produces no meaningful scalar (categorical mode, affinity with heterogeneous cpusets).

Source

pub fn mode_single( value: impl Into<String>, count: usize, total: usize, ) -> Aggregated

Construct an Aggregated::Mode from a single (value, count, total) triple, common in test fixtures and the single-bucket aggregate path. Equivalent to inserting (value, count) into a fresh tally map. count == 0 produces an empty tally (the empty-bucket shape), preserving the historical contract that an empty Mode renders as ~ while still carrying a well-defined total for the rendered “(count/total)” suffix.

Source

pub fn mode_value(&self) -> &str

The most-frequent value tracked by an Aggregated::Mode, or the empty string when the tallies map is empty (an empty bucket whose total may still be non-zero, e.g. when every contributor produced no categorical sample). Ties on count are broken by lexicographic order on the VALUE — the lex-smallest key wins. Deterministic across runs and matches the historical Mode contract under the old value, count shape.

Source

pub fn mode_count(&self) -> usize

The frequency count of the mode value. Zero when the tallies map is empty (no contributor produced a categorical sample). Same tie-break as Self::mode_value.

Trait Implementations§

Source§

impl Clone for Aggregated

Source§

fn clone(&self) -> Aggregated

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Aggregated

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Aggregated

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,