ktstr/ctprof_compare/
mod.rs

1//! Group, aggregate, and render the comparison between two
2//! `CtprofSnapshot`s.
3//!
4//! Design summary: the per-thread profiler emits
5//! one snapshot per run. Comparison groups threads within each
6//! snapshot by a single axis (pcomm, cgroup, comm, or
7//! comm-exact), or by all pattern-aware axes at once
8//! ([`GroupBy::All`]) — see [`GroupBy`]; aggregates every metric per
9//! the rule on its [`CtprofMetricDef`], then matches groups
10//! across the two snapshots and emits one row per
11//! `(group, metric)` pair. Groups present on only one side
12//! surface as unmatched entries rather than imaginary
13//! zero-valued rows — a row is missing because the process did
14//! not exist, not because it did zero work.
15//!
16//! No judgment labels. The comparison prints raw numbers and
17//! percent delta; interpretation (regression vs improvement) is
18//! scheduler-specific and left to the user. This deliberately
19//! diverges from the gauntlet stats comparison in `crate::stats`,
20//! which DOES classify each metric (`Finding::kind`,
21//! `CompareReport::{regressions, improvements, unchanged}`):
22//! ctprof_compare emits no verdict.
23
24mod pattern;
25pub use pattern::{pattern_display_label, pattern_key};
26
27mod scale;
28pub use scale::{
29    ScaleLadder, cgroup_limits_cell, cgroup_optional_limit_cell, format_cpu_max,
30    format_derived_delta_cell, format_derived_value_cell, format_optional_limit, format_scaled_u64,
31    format_value_cell,
32};
33
34mod options;
35pub use options::{AggRule, CompareOptions, GroupBy, GroupByOrDefault, SortKey};
36
37mod metrics;
38pub use metrics::{
39    CTPROF_DERIVED_METRICS, CTPROF_METRICS, CtprofMetricDef, DerivedMetricDef, DerivedValue,
40    metric_display_name, metric_tags,
41};
42
43mod aggregate;
44pub use aggregate::{AffinitySummary, Aggregated};
45
46mod diff_types;
47pub use diff_types::{CtprofDiff, DerivedRow, DiffRow, FudgedPair, ThreadGroup};
48
49mod cgroup_merge;
50
51mod groups;
52pub use groups::{
53    aggregate, build_cgroup_key_map, build_groups, collect_smaps_rollup,
54    collect_smaps_rollup_hierarchical, compile_flatten_patterns, flatten_cgroup_path,
55};
56
57mod compare;
58pub use compare::{compare, flatten_cgroup_stats};
59
60mod columns;
61pub use columns::{
62    Column, DisplayFormat, Section, parse_columns, parse_metrics, parse_sections,
63    warn_cgroup_only_sections_under_non_cgroup,
64};
65mod runner;
66pub use runner::{
67    CtprofCompareArgs, DisplayOptions, limit_sections, parse_sort_by, print_diff,
68    print_metric_list, run_compare, run_metric_list, write_metric_list,
69};
70
71mod render;
72pub use render::{
73    cgroup_cell, color_derived_cells, color_diff_cell, colored_header, colored_header_with_sort,
74    format_psi_avg_cell, format_psi_avg_centi_percent,
75};
76
77mod report;
78pub use report::write_diff;
79
80#[cfg(test)]
81mod tests_aggregate;
82#[cfg(test)]
83mod tests_cgroup_merge;
84#[cfg(test)]
85mod tests_columns;
86#[cfg(test)]
87mod tests_compare;
88#[cfg(test)]
89mod tests_diff_types;
90#[cfg(test)]
91mod tests_fixtures;
92#[cfg(test)]
93mod tests_groups;
94#[cfg(test)]
95mod tests_metrics;
96#[cfg(test)]
97mod tests_options;
98#[cfg(test)]
99mod tests_pattern;
100#[cfg(test)]
101mod tests_render;
102#[cfg(test)]
103mod tests_report;
104#[cfg(test)]
105mod tests_runner;
106#[cfg(test)]
107mod tests_scale;