[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240814141942.2513194-1-kan.liang@linux.intel.com>
Date: Wed, 14 Aug 2024 07:19:42 -0700
From: kan.liang@...ux.intel.com
To: acme@...nel.org,
namhyung@...nel.org,
irogers@...gle.com,
peterz@...radead.org,
mingo@...nel.org,
linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Cc: Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH] perf report: Support --total-cycles --group in the tui mode
From: Kan Liang <kan.liang@...ux.intel.com>
With the --total-cycles, the --group is only supported in the stdio
mode, but not supported in the tui mode. The output is inconsistent
with different modes.
if symbol_conf.event_group is applied, always output the event group
information together in tui mode as well.
$perf record -e "{cycles,instructions}",cache-misses -b sleep 1
$perf report --total-cycles --group --tui
Before the patch,
Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Pro
6.45% 2.0K 0.57% 667 [dl-cacheinfo.h:164 -> dl
5.62% 1.7K 0.74% 871 [dl-cache.c:230 -
5.21% 1.6K 1.37% 1.6K [setup-vdso.h:37 ->
4.92% 1.5K 0.09% 109 [dl-cache.c:367 -
Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Pro
5.62% 1.7K 2.76% 871 [dl-cache.c:230 -
4.92% 1.5K 0.35% 109 [dl-cache.c:367 -
1.12% 346 0.55% 173
0.87% 270 0.43% 135 [rtld.c:5
0.64% 197 0.03% 8 [dl-tunables.c:305 -> d
0.60% 185 0.01% 3 [dl-tunables.c:305 -> d
Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Pro
5.90% 1.8K 1.28% 1.8K [strtod.c:8
5.70% 1.8K 1.24% 1.8K [strtod_l.c:681 -
5.68% 1.8K 1.24% 1.8K [strtod_l.c:508 -
5.48% 1.7K 1.19% 1.7K [strtod_l.c:1175 ->
5.21% 1.6K 1.13% 1.6K [setup-vdso.h:37 ->
With the patch,
Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Pro
6.45% 2.0K 0.57% 667 [dl-cacheinfo.h:164 -> dl
5.62% 1.7K 0.74% 871 [dl-cache.c:230 -
5.21% 1.6K 1.37% 1.6K [setup-vdso.h:37 ->
4.92% 1.5K 0.09% 109 [dl-cache.c:367 -
Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles [Pro
5.90% 1.8K 1.28% 1.8K [strtod.c:8
5.70% 1.8K 1.24% 1.8K [strtod_l.c:681 -
5.68% 1.8K 1.24% 1.8K [strtod_l.c:508 -
5.48% 1.7K 1.19% 1.7K [strtod_l.c:1175 ->
5.21% 1.6K 1.13% 1.6K [setup-vdso.h:37 ->
Fixes: 7fa46cbf20d3 ("perf report: Sort by sampled cycles percent per block for tui")
Closes: https://lore.kernel.org/lkml/ZrupfUSZwem-hCZm@x1/
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
---
tools/perf/builtin-report.c | 6 +++++-
tools/perf/ui/browsers/hists.c | 12 ++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1643113616f4..574342fb7269 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -541,7 +541,11 @@ static int evlist__tui_block_hists_browse(struct evlist *evlist, struct report *
int i = 0, ret;
evlist__for_each_entry(evlist, pos) {
- ret = report__browse_block_hists(&rep->block_reports[i++].hist,
+ i++;
+ if (symbol_conf.event_group && !evsel__is_group_leader(pos))
+ continue;
+
+ ret = report__browse_block_hists(&rep->block_reports[i - 1].hist,
rep->min_percent, pos,
&rep->session->header.env);
if (ret != 0)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 49ba82bf3391..22af1a6e29d6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -3665,11 +3665,19 @@ single_entry: {
static int block_hists_browser__title(struct hist_browser *browser, char *bf,
size_t size)
{
- struct hists *hists = evsel__hists(browser->block_evsel);
- const char *evname = evsel__name(browser->block_evsel);
+ struct evsel *evsel = browser->block_evsel;
+ struct hists *hists = evsel__hists(evsel);
unsigned long nr_samples = hists->stats.nr_samples;
+ const char *evname;
+ char buf[512];
int ret;
+ if (evsel__is_group_event(evsel)) {
+ evsel__group_desc(evsel, buf, sizeof(buf));
+ evname = buf;
+ } else
+ evname = evsel__name(evsel);
+
ret = scnprintf(bf, size, "# Samples: %lu", nr_samples);
if (evname)
scnprintf(bf + ret, size - ret, " of event '%s'", evname);
--
2.38.1
Powered by blists - more mailing lists