]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf hist: Remove formats in hierarchy when cancel latency
authorNamhyung Kim <namhyung@kernel.org>
Mon, 31 Mar 2025 07:37:20 +0000 (00:37 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 Apr 2025 15:31:51 +0000 (12:31 -0300)
Likewise, it should remove latency output fields in hierarchy list.
Pass evlist to perf_hpp__cancel_latency() to handle them properly.

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

index c9138e1379808097b15c47945c2dfa9ca13e24b3..c207aaed7ae5fc2b4f23a5c2a2ff0ce88aede9f9 100644 (file)
@@ -1088,7 +1088,7 @@ static int __cmd_report(struct report *rep)
        /* Don't show Latency column for non-parallel profiles by default. */
        if (!symbol_conf.prefer_latency && rep->total_samples &&
                rep->singlethreaded_samples * 100 / rep->total_samples >= 99)
-               perf_hpp__cancel_latency();
+               perf_hpp__cancel_latency(session->evlist);
 
        evlist__check_mem_load_aux(session->evlist);
 
index 1d3f944ed35ed152054612306529df80203c4029..3ffce69fc823e0bf69f1a6caf04f73356d5e999a 100644 (file)
@@ -739,9 +739,10 @@ void perf_hpp__cancel_cumulate(struct evlist *evlist)
        }
 }
 
-void perf_hpp__cancel_latency(void)
+void perf_hpp__cancel_latency(struct evlist *evlist)
 {
        struct perf_hpp_fmt *fmt, *lat, *acc, *tmp;
+       struct evsel *evsel;
 
        if (is_strict_order(field_order))
                return;
@@ -755,6 +756,18 @@ void perf_hpp__cancel_latency(void)
                if (fmt_equal(lat, fmt) || fmt_equal(acc, fmt))
                        perf_hpp__column_unregister(fmt);
        }
+
+       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(lat, fmt) || fmt_equal(acc, fmt))
+                                       perf_hpp__column_unregister(fmt);
+                       }
+               }
+       }
 }
 
 void perf_hpp__setup_output_field(struct perf_hpp_list *list)
index 8cc94928fcb35a5b37b463e702e4c034b4e9d3d1..76efd8952507a5610ad221085eef23fa0e1eaede 100644 (file)
@@ -582,7 +582,7 @@ enum {
 
 void perf_hpp__init(void);
 void perf_hpp__cancel_cumulate(struct evlist *evlist);
-void perf_hpp__cancel_latency(void);
+void perf_hpp__cancel_latency(struct evlist *evlist);
 void perf_hpp__setup_output_field(struct perf_hpp_list *list);
 void perf_hpp__reset_output_field(struct perf_hpp_list *list);
 void perf_hpp__append_sort_keys(struct perf_hpp_list *list);