CtprofCompareArgs

Struct CtprofCompareArgs 

Source
pub struct CtprofCompareArgs {
Show 13 fields pub baseline: PathBuf, pub candidate: PathBuf, pub group_by: GroupBy, pub cgroup_flatten: Vec<String>, pub no_thread_normalize: bool, pub no_cg_normalize: bool, pub sort_by: String, pub display_format: DisplayFormat, pub columns: String, pub sections: String, pub metrics: String, pub wrap: bool, pub limit: usize,
}
Expand description

Arguments for the ktstr ctprof compare subcommand.

Fields§

§baseline: PathBuf

Baseline snapshot (.ctprof.zst) from ktstr ctprof capture -o.

§candidate: PathBuf

Candidate snapshot (.ctprof.zst) from ktstr ctprof capture -o.

§group_by: GroupBy

Grouping key. pcomm aggregates per process name with token-based pattern normalization (so worker-{0..N} parent processes cluster into one worker-{N} bucket); cgroup per cgroup path; comm aggregates threads by NAME PATTERN under the same token-based normalizer (digits, hex, alpha-prefix-digits collapse into placeholders so tokio-worker-{0..N} and kworker/u8:7 cluster); use --no-thread-normalize to disable that collapse and group by literal comm / pcomm instead. comm-exact disables thread-axis normalization only — its smaps keys stay pcomm-pattern normalized — unlike comm --no-thread-normalize, which also keys smaps literally per-PID; see GroupBy::CommExact.

Under all (default): also activates fudging — pairs of cgroups with renamed-but-identical thread populations (Jaccard similarity ≥ 0.90 over (pcomm, comm) thread types, both sides ≥ 10 distinct types) are joined for diffing instead of surfacing as orphans. Fudged rows render with a [fudged: <leaf>] marker; the ## Fudged cgroup matches section at the bottom of the output details the matched pairs and their jaccard / overlap / cascade roots / residuals.

§cgroup_flatten: Vec<String>

Glob patterns that collapse dynamic cgroup path segments so structurally-equivalent cgroups across runs group together. Example: --cgroup-flatten '/kubepods/*/workload' treats different pod IDs as the same group. Repeatable. Independent of --no-cg-normalize: explicit globs apply first, then auto-normalize runs unless disabled.

§no_thread_normalize: bool

Disable token-based pattern normalization across every name-family axis: --group-by comm, --group-by pcomm, AND the ## smaps_rollup per-process keying (which normalizes by the pcomm pattern by default — see collect_smaps_rollup). With this flag set: threads / processes group by their literal name; smaps rows preserve their per-PID identity (pcomm[tgid] instead of the normalized pcomm pattern). The digit/hex/alpha-prefix placeholders are bypassed on every axis. Has no effect under --group-by comm-exact (already literal) or --group-by cgroup. Mirror of --no-cg-normalize for the cgroup axis.

§no_cg_normalize: bool

Disable token-based pattern normalization for the cgroup axis (--group-by cgroup). Cgroup paths group by literal post---cgroup-flatten path — Layer 1 (systemd template @<id>.service@{I}.service), Layer 2 (token normalization), and Layer 3 (tighten) are all bypassed. Has no effect under any other grouping.

§sort_by: String

Multi-key sort spec for the diff rows. Format: metric1[:dir1],metric2[:dir2],... where each metric is one of the primary or derived metric names (run ctprof metric-list for the full vocabulary) and dir is asc or desc (default desc). Groups rank by the tuple (metric1_delta, metric2_delta, …) under lexicographic order with per-key direction; rows within a group keep registry order. Empty (the default) keeps the “biggest |delta_pct|” sort. Examples:

  • --sort-by wait_sum:desc,run_time_ns:desc — rank by the largest scheduler-wait deltas first, breaking ties by run-time delta.
  • --sort-by hiwater_rss_bytes:desc — rank by the largest peak-RSS growth across the snapshot. Useful for memory-leak investigations.
  • --sort-by avg_wait_ns:asc — rank by smallest average wait time first; surfaces the most-improved processes.

Affects only the per-thread metric table and the derived-metrics section. The ## smaps_rollup sub-table sorts process rows independently by absolute Rss delta descending (tiebreak: max-Rss, then name; see sorted_smaps_process_keys); a future flag could expose that knob, but --sort-by does not propagate to it today.

Parsed by parse_sort_by into CompareOptions::sort_by.

§display_format: DisplayFormat

Per-row column layout. full emits the seven-column form; delta-only drops baseline + candidate; no-pct drops the percentage column; arrow collapses baseline / candidate into one baseline -> candidate cell paired with separate Delta and Pct columns; pct-only keeps just the percentage. arrow (default) collapses baseline / candidate into one cell paired with Delta and Pct columns. --columns (below) overrides the format’s default column set when both are present.

§columns: String

Comma-separated column names to render. Empty (the default) means “use the column set selected by –display-format.” Valid names: group, threads, metric, baseline, candidate, delta, %, arrow, tags, uptime. Order in the spec is the rendered order. Example: --columns metric,delta,%. Applies to the primary section’s per-metric table only; secondary tables (cgroup-stats, smaps-rollup, etc.) have fixed column shapes and ignore this flag.

§sections: String

Comma-separated section names to render. Empty (the default) renders every section that has data. When non-empty, restricts output to the listed sub-tables — every section not named is suppressed before its data-availability gate runs. Valid names: primary, taskstats-delay, derived, cgroup-stats, cgroup-limits, memory-stat, memory-events, pressure, host-pressure, smaps-rollup, sched-ext. Useful for narrowing a wide compare to one area of interest. Example: --sections primary,host-pressure.

§metrics: String

Comma-separated metric names to render. Empty (the default) renders every metric in the primary and derived sub-tables. When non-empty, restricts the rendered ROWS to the listed names — names must come from the ctprof metric-list vocabulary (CTPROF_METRICS or CTPROF_DERIVED_METRICS). Useful for zooming on a specific counter family without computing every metric: --metrics run_time_ns,wait_sum,affine_success_ratio. Composes with --sections — naming --sections primary --metrics run_time_ns shows a single primary row.

§wrap: bool

Wrap table cells to fit the terminal width. Off by default — wide tables can spill past the terminal edge, matching the prior shell-pipeline-friendly layout. When set, cells too wide for the available width wrap inside the cell rather than overflowing, at the cost of taller rows. The wrap kicks in only when stdout is a tty (the terminal width is unknown otherwise); when piped to a file or another command, the flag is silently dropped and output stays unwrapped so awk/grep pipelines see the same byte sequence as without the flag.

§limit: usize

Maximum rendered lines per section. Sections whose table output exceeds this limit are truncated with a notice showing the number of hidden lines. Applies independently to each sub-table (primary, derived, smaps-rollup, etc.). 0 disables truncation entirely. Default 500.

Trait Implementations§

Source§

impl Args for CtprofCompareArgs

Source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

impl Debug for CtprofCompareArgs

Source§

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

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

impl FromArgMatches for CtprofCompareArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

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