From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: [PATCH 3/4] perf report: Fix histogram entry collapsing for -F option
Date: Tue, 9 Dec 2025 18:33:26 -0800 [thread overview]
Message-ID: <20251210023327.1669863-3-namhyung@kernel.org> (raw)
In-Reply-To: <20251210023327.1669863-1-namhyung@kernel.org>
Users can use -F/--fields option to set output fields and sort keys
together. But it missed to set perf_hpp_list->need_collapse for sort
entries that have se_collapse callbacks. So it ends up with having
duplicated entries separately.
For example, let's run this command first.
$ perf mem record -t load -U -- perf test -w datasym
This will record samples for memory access (load) to struct 'buf' and a
loop condition ('sig_atomic_t') types. So the following two commands
should have identical output.
$ perf report -s type --stdio --percent-limit=1 -q
87.80% perf buf
12.17% perf sig_atomic_t
But using -F option didn't collapse the entries based on types so the
result looked like below:
$ perf report -F overhead,type --stdio --percent-limit=1 -q
23.31% perf buf
22.84% perf buf
21.26% perf buf
20.39% perf buf
12.17% perf sig_atomic_t
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/sort.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index a0a5c1c40af0c318..c51604eaae0a4b90 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -3578,6 +3578,9 @@ static int __sort_dimension__add_output(struct perf_hpp_list *list,
if (__sort_dimension__add_hpp_output(sd, list, level) < 0)
return -1;
+ if (sd->entry->se_collapse)
+ list->need_collapse = 1;
+
sd->taken = 1;
return 0;
}
--
2.52.0.223.gf5cc29aaa4-goog
next prev parent reply other threads:[~2025-12-10 2:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 2:33 [PATCH 1/4] perf record: Split --data-mmap option Namhyung Kim
2025-12-10 2:33 ` [PATCH 2/4] perf report: Enable data-type profiling with -F option too Namhyung Kim
2025-12-10 22:05 ` Ian Rogers
2025-12-10 2:33 ` Namhyung Kim [this message]
2025-12-10 22:06 ` [PATCH 3/4] perf report: Fix histogram entry collapsing for -F option Ian Rogers
2025-12-10 2:33 ` [PATCH 4/4] perf report: Update sort key state from " Namhyung Kim
2025-12-10 22:06 ` Ian Rogers
2025-12-10 22:05 ` [PATCH 1/4] perf record: Split --data-mmap option Ian Rogers
2025-12-17 12:37 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251210023327.1669863-3-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox