Now it can handle multiple output fields and sort keys in separate
levels, so it should be ok to use it in the hierarchy mode. This
allows fully customized output format.
$ perf report -F latency,comm,parallelism -H --stdio
...
# Latency Command / Parallelism
# ........... .....................
#
31.84% cc1
29.96% 5
1.24% 4
0.37% 6
0.26% 3
0.02% 2
24.68% as
22.39% 5
1.12% 2
0.98% 4
0.12% 3
0.07% 6
...
Committer testing:
Before:
$ perf report -F latency,comm,parallelism -H --stdio
Error: --hierarchy and --fields options cannot be used together
Usage: perf report [<options>]
-F, --fields <key[,keys...]>
output field(s): overhead latency overhead_sys overhead_us
overhead_guest_sys overhead_guest_us overhead_children
latency_children sample period weight1 weight2 weight3
<SNIP>
-H, --hierarchy Show entries in a hierarchy
$
After:
$ perf report -F latency,comm,parallelism -H --stdio
# Total Lost Samples: 0
#
# Samples: 1K of event 'cycles:Pu'
# Event count (approx.):
1581450138
#
# Latency Command / Parallelism
# ........... .....................
#
97.66% git
96.95% 1
0.55% 2
0.04% 5
0.03% 8
0.03% 4
0.02% 3
0.01% 9
0.01% 7
0.01% 6
0.01% 10
0.00% 12
2.34% git-remote-http
2.24% 1
0.07% 5
0.02% 2
0.00% 4
#
# (Tip: To analyze particular parallelism levels, try: perf report --latency --parallelism=32-64)
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250331073722.4695-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
}
if (symbol_conf.report_hierarchy) {
- /* disable incompatible options */
- if (field_order) {
- pr_err("Error: --hierarchy and --fields options cannot be used together\n");
- parse_options_usage(report_usage, options, "F", 1);
- parse_options_usage(NULL, options, "hierarchy", 0);
- goto error;
- }
-
+ /*
+ * The hist entries in hierarchy are added during the collpase
+ * phase. Let's enable it even if no sort keys require it.
+ */
perf_hpp_list.need_collapse = true;
}