Commit 9b6563bf authored by Yicong Yang's avatar Yicong Yang Committed by Wentao Guan
Browse files

perf stat: Display iostat headers correctly

stable inclusion
from stable-v6.6.54
commit fa0720b32afa89496fc0cf5c96705a908311cf40
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZ3K2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fa0720b32afa89496fc0cf5c96705a908311cf40



--------------------------------

[ Upstream commit 2615639352420e6e3115952c5b8f46846e1c6d0e ]

Currently we'll only print metric headers for metric leader in
aggregration mode. This will make `perf iostat` header not shown
since it'll aggregrated globally but don't have metric events:

  root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
   Performance counter stats for 'system wide':
      port
  0000:00                    0                    0                    0                    0
  0000:80                    0                    0                    0                    0
  [...]

Fix this by excluding the iostat in the check of printing metric
headers. Then we can see the headers:

  root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
   Performance counter stats for 'system wide':
      port             Inbound Read(MB)    Inbound Write(MB)    Outbound Read(MB)   Outbound Write(MB)
  0000:00                    0                    0                    0                    0
  0000:80                    0                    0                    0                    0
  [...]

Fixes: 193a9e30207f5477 ("perf stat: Don't display metric header for non-leader uncore events")
Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: Junhao He <hejunhao3@huawei.com>
Cc: linuxarm@huawei.com
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Cc: Zeng Tao <prime.zeng@hisilicon.com>
Link: https://lore.kernel.org/r/20240802065800.48774-1-yangyicong@huawei.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit fa0720b32afa89496fc0cf5c96705a908311cf40)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 09c70578
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1207,7 +1207,8 @@ static void print_metric_headers(struct perf_stat_config *config,

	/* Print metrics headers only */
	evlist__for_each_entry(evlist, counter) {
		if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
		if (!config->iostat_run &&
		    config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
			continue;

		os.evsel = counter;