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 From<GroupBy> for GroupByOrDefault
impl From<GroupBy> for GroupByOrDefault
impl Copy for GroupBy
impl Eq for GroupBy
impl StructuralPartialEq for GroupBy
Auto Trait Implementations§
impl Freeze for GroupBy
impl RefUnwindSafe for GroupBy
impl Send for GroupBy
impl Sync for GroupBy
impl Unpin for GroupBy
impl UnwindSafe for GroupBy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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