From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>
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,
Yicong Yang <yangyicong@hisilicon.com>
Subject: [PATCH 2/2] perf stat: Fix a segfault with --per-cluster --metric-only
Date: Thu, 27 Jun 2024 13:03:53 -0700 [thread overview]
Message-ID: <20240627200353.1230407-2-namhyung@kernel.org> (raw)
In-Reply-To: <20240627200353.1230407-1-namhyung@kernel.org>
The new --per-cluster option was added recently but it forgot to update
the aggr_header fields which are used for --metric-only option. And it
resulted in a segfault due to NULL string in fputs().
Fixes: cbc917a1b03b ("perf stat: Support per-cluster aggregation")
Cc: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/stat-display.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index e8673c9f6b49..462227f663cb 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -38,6 +38,7 @@
static int aggr_header_lens[] = {
[AGGR_CORE] = 18,
[AGGR_CACHE] = 22,
+ [AGGR_CLUSTER] = 20,
[AGGR_DIE] = 12,
[AGGR_SOCKET] = 6,
[AGGR_NODE] = 6,
@@ -49,6 +50,7 @@ static int aggr_header_lens[] = {
static const char *aggr_header_csv[] = {
[AGGR_CORE] = "core%scpus%s",
[AGGR_CACHE] = "cache%scpus%s",
+ [AGGR_CLUSTER] = "cluster%scpus%s",
[AGGR_DIE] = "die%scpus%s",
[AGGR_SOCKET] = "socket%scpus%s",
[AGGR_NONE] = "cpu%s",
@@ -60,6 +62,7 @@ static const char *aggr_header_csv[] = {
static int aggr_header_num[] = {
[AGGR_CORE] = 2,
[AGGR_CACHE] = 2,
+ [AGGR_CLUSTER] = 2,
[AGGR_DIE] = 2,
[AGGR_SOCKET] = 2,
[AGGR_NONE] = 1,
--
2.45.2.803.g4e1b14247a-goog
next prev parent reply other threads:[~2024-06-27 20:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 20:03 [PATCH 1/2] perf stat: Use field separator in the metric header Namhyung Kim
2024-06-27 20:03 ` Namhyung Kim [this message]
2024-06-28 12:47 ` [PATCH 2/2] perf stat: Fix a segfault with --per-cluster --metric-only Arnaldo Carvalho de Melo
2024-06-27 20:48 ` [PATCH 1/2] perf stat: Use field separator in the metric header Ian Rogers
2024-06-27 22:23 ` Namhyung Kim
2025-02-24 18:50 ` Ian Rogers
2025-02-24 20:18 ` Namhyung Kim
2024-06-28 12:44 ` 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=20240627200353.1230407-2-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=yangyicong@hisilicon.com \
/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;
as well as URLs for NNTP newsgroup(s).