]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf hist: Remove formats in hierarchy when cancel children
authorNamhyung Kim <namhyung@kernel.org>
Mon, 31 Mar 2025 07:37:19 +0000 (00:37 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 Apr 2025 15:31:47 +0000 (12:31 -0300)
This is to support hierarchy options with custom output fields.
Currently perf_hpp__cancel_cumulate() only removes accumulated
overhead and latency fields from the global perf_hpp_list.

This is not used in the hierarchy mode because each evsel's hist
has its own separate hpp_list.  So it needs to remove the fields
from the lists too.  Pass evlist to the function so that it can
iterate the evsels.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
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-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/ui/hist.c
tools/perf/util/hist.h

index b030ce72e13ea8d1f93c5a2717bfafd18b55104d..c9138e1379808097b15c47945c2dfa9ca13e24b3 100644 (file)
@@ -413,7 +413,7 @@ static int report__setup_sample_type(struct report *rep)
                /* Silently ignore if callchain is missing */
                if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) {
                        symbol_conf.cumulate_callchain = false;
-                       perf_hpp__cancel_cumulate();
+                       perf_hpp__cancel_cumulate(session->evlist);
                }
        }
 
index 1061f4eebc3f64146f18c01e88e8c01708cdf441..f9f31391bddba0749e7047e56741385362b587cf 100644 (file)
@@ -1790,7 +1790,7 @@ int cmd_top(int argc, const char **argv)
 
        if (!callchain_param.enabled) {
                symbol_conf.cumulate_callchain = false;
-               perf_hpp__cancel_cumulate();
+               perf_hpp__cancel_cumulate(top.evlist);
        }
 
        if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
index ae3b7fe1dadc8f22b34a0c0708880217e701c0a9..1d3f944ed35ed152054612306529df80203c4029 100644 (file)
@@ -699,9 +699,10 @@ static void perf_hpp__column_unregister(struct perf_hpp_fmt *format)
        fmt_free(format);
 }
 
-void perf_hpp__cancel_cumulate(void)
+void perf_hpp__cancel_cumulate(struct evlist *evlist)
 {
        struct perf_hpp_fmt *fmt, *acc, *ovh, *acc_lat, *tmp;
+       struct evsel *evsel;
 
        if (is_strict_order(field_order))
                return;
@@ -719,6 +720,23 @@ void perf_hpp__cancel_cumulate(void)
                if (fmt_equal(ovh, fmt))
                        fmt->name = "Overhead";
        }
+
+       evlist__for_each_entry(evlist, evsel) {
+               struct hists *hists = evsel__hists(evsel);
+               struct perf_hpp_list_node *node;
+
+               list_for_each_entry(node, &hists->hpp_formats, list) {
+                       perf_hpp_list__for_each_format_safe(&node->hpp, fmt, tmp) {
+                               if (fmt_equal(acc, fmt) || fmt_equal(acc_lat, fmt)) {
+                                       perf_hpp__column_unregister(fmt);
+                                       continue;
+                               }
+
+                               if (fmt_equal(ovh, fmt))
+                                       fmt->name = "Overhead";
+                       }
+               }
+       }
 }
 
 void perf_hpp__cancel_latency(void)
index 317d06cca8b88e3ea45cb80fff9a47318ae39fdc..8cc94928fcb35a5b37b463e702e4c034b4e9d3d1 100644 (file)
@@ -581,7 +581,7 @@ enum {
 };
 
 void perf_hpp__init(void);
-void perf_hpp__cancel_cumulate(void);
+void perf_hpp__cancel_cumulate(struct evlist *evlist);
 void perf_hpp__cancel_latency(void);
 void perf_hpp__setup_output_field(struct perf_hpp_list *list);
 void perf_hpp__reset_output_field(struct perf_hpp_list *list);