GroupBy

Enum GroupBy 

Source
pub enum GroupBy {
    Pcomm,
    Cgroup,
    Comm,
    CommExact,
    All,
}
Expand description

Grouping key for the ctprof compare.

The default is GroupBy::Pcomm — aggregate every thread belonging to the same process name together with token-based pattern normalization, so ephemeral worker pools whose pcomm differs only by digit-suffix collapse across snapshots. The other variants exist for operators who want to slice along a different axis: Cgroup groups by cgroup path (useful for container-per-workload deployments); Comm groups by thread name across every process with the same token-based pattern normalization (so tokio-worker-{0..N} collapse into one tokio-worker-{N} bucket and kworker/0:1H-events_highpri, kworker/1:0H-events_highpri, … collapse into one kworker/{N}:{N}H-events_highpri bucket); CommExact groups by literal thread name (useful when distinct token values carry meaning that the normalizer would erase, e.g. tracking each per-CPU kworker/u8:N independently).

Variants§

§

Pcomm

Group by process name (pcomm). Default grouping: pcomm is the leader thread’s task->comm, read from /proc/<tgid>/comm at capture time (see crate::ctprof::ThreadState::pcomm). Per-thread comm values, by contrast, can drift over a process’s lifetime (worker threads reset their comm under load, taskset toggles names, etc.); the leader’s comm is the per-process identity captured at snapshot time and stays constant across that snapshot. Pcomm grouping is therefore the most reliable axis for “give me the per-process resource picture”, which is why it’s the default.

Naive pcomm grouping has one common failure mode: workers with digit suffixes (worker-0, worker-1, …) each land in their own bucket and the per-pool aggregate gets scattered across N rows. Token-based pattern normalization handles this: pcomms that produce the same skeleton under pattern_key’s normalizer cluster into one bucket whose internal join key is the skeleton. The normalizer splits each pcomm on a separator class ([.\-_/:@+\[\]\s]+) and classifies each token as pure-digit ({N}), hex-like ({H}), alpha-prefix-plus-digits (prefix{N}), digits-plus-alpha-suffix ({N}suffix), or literal — identical rules to the Comm axis. Singleton buckets revert to the literal pcomm so a lone process stays ungrouped instead of advertising a worker-{N} pattern that no other process shares. Display labels are generated by grex for buckets with ≥ 2 distinct member pcomms; the rendered label is a regex showing the shared prefix + alternation, while the join key remains deterministic across snapshots. Disable normalization with CompareOptions::no_thread_normalize to group by literal pcomm.

§

Cgroup

Group by cgroup path. Cgroup-level enrichment is surfaced in the output alongside the aggregated thread metrics.

§

Comm

Group by thread name pattern across every process. Threads whose names produce the same skeleton under pattern_key’s token-based normalizer cluster into one bucket whose internal join key is the skeleton. The normalizer splits each comm on a separator class ([.\-_/:@+\[\]\s]+) and classifies each token as pure-digit ({N}), hex-like ({H}), alpha-prefix-plus-digits (prefix{N}), digits-plus-alpha-suffix ({N}suffix), or literal. Singleton buckets revert to the literal thread name so a lone worker stays ungrouped. Display labels are generated by grex for buckets with ≥2 distinct member names; the rendered label is a regex showing the shared prefix + alternation, while the join key remains deterministic across snapshots. Disable normalization with CompareOptions::no_thread_normalize.

§

CommExact

Group by literal thread name (comm) — exact match, no pattern aggregation. Use this when distinct token values carry meaning the normalizer would erase, e.g. tracking each per-CPU kworker/u8:N independently rather than collapsing the fleet into one kworker/u{N}:{N} bucket.

Distinct from --group-by comm --no-thread-normalize: this variant ONLY disables thread-axis normalization, leaving the smaps_rollup pcomm keying still normalized (per collect_smaps_rollup). The --no-thread-normalize flag, by contrast, disables normalization across every name-family axis (Comm, Pcomm, AND smaps_rollup). Pick CommExact when you want literal thread names but still want smaps to join across snapshots; pick Comm + no_thread_normalize when you also want literal smaps PID identity.

§

All

Run all three pattern-aware axes (Cgroup → Pcomm → Comm) and render each as a labeled block. Gives a comprehensive at-a-glance summary without re-running with different --group-by flags. Each axis gets its own ## Primary metrics section, independently truncated by --limit.

Trait Implementations§

Source§

impl Clone for GroupBy

Source§

fn clone(&self) -> GroupBy

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 GroupBy

Source§

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

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

impl From<GroupBy> for GroupByOrDefault

Source§

fn from(g: GroupBy) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for GroupBy

Source§

fn eq(&self, other: &GroupBy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ValueEnum for GroupBy

Source§

fn value_variants<'a>() -> &'a [Self]

All possible argument values, in display order.
Source§

fn to_possible_value<'a>(&self) -> Option<PossibleValue>

The canonical argument value. Read more
§

fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>

Parse an argument into Self.
Source§

impl Copy for GroupBy

Source§

impl Eq for GroupBy

Source§

impl StructuralPartialEq for GroupBy

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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, 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,