[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260211013900.3009454-1-namhyung@kernel.org>
Date: Tue, 10 Feb 2026 17:39:00 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ian Rogers <irogers@...gle.com>,
James Clark <james.clark@...aro.org>
Cc: Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org,
Frederic Weisbecker <fweisbec@...il.com>
Subject: [PATCH] perf report: Get rid of unnecessary comm collapsing
The sort_entry->collapse() callback is to merge related hist entries.
It's called in hists__collapse_resort() after processing samples using
the ->cmp() callback first. The idea was to speed up processing with
lighter-weight operation in ->cmp() and do heavier one in ->collapse().
Note that ->cmp() will be called for every sample, but ->collapse() will
be called for each hist entry which is pre-processed already. So it's
meaningless to have ->collapse() if it's the same as ->cmp().
The 'comm' sort key used to compare 'tid' in ->cmp() and strcmp() in the
collapse callback. Then commit fedd63d3cdc9004d ("perf tools: Compare
hists comm by addresses") added comm_str and changed it to compare the
pointer values. Later, commit 2f15bd8c6c6e80f1 ("perf tools: Fix
"Command" sort_entry's cmp and collapse function") changed to compare
trings.
Now 'comm' sort key compares the string from the beginning so there's no
point to keep the collapse callback. This will get rid of unnecessary
processing in hists__collapse_resort(). It'd give a little speedup on
large data files with a lot of threads. But I didn't see it actually
from my quick testing.
Cc: Frederic Weisbecker <fweisbec@...il.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/util/sort.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 42d5cd7ef4e23960..66c45f450e5101e5 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -237,12 +237,6 @@ sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
return strcmp(comm__str(right->comm), comm__str(left->comm));
}
-static int64_t
-sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
-{
- return strcmp(comm__str(right->comm), comm__str(left->comm));
-}
-
static int64_t
sort__comm_sort(struct hist_entry *left, struct hist_entry *right)
{
@@ -258,7 +252,6 @@ static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
struct sort_entry sort_comm = {
.se_header = "Command",
.se_cmp = sort__comm_cmp,
- .se_collapse = sort__comm_collapse,
.se_sort = sort__comm_sort,
.se_snprintf = hist_entry__comm_snprintf,
.se_filter = hist_entry__thread_filter,
--
2.53.0.239.g8d8fc8a987-goog
Powered by blists - more mailing lists