From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Derek Foreman <derek.foreman@collabora.com>,
Thomas Falcon <thomas.falcon@intel.com>,
Howard Chu <howardchu95@gmail.com>,
Swapnil Sapkal <swapnil.sapkal@amd.com>,
Anubhav Shelat <ashelat@redhat.com>,
Chun-Tse Shao <ctshao@google.com>,
Hrishikesh Suresh <hrishikesh123s@gmail.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/5] perf header: Add utility to convert feature number to a string
Date: Wed, 25 Feb 2026 17:35:31 -0800 [thread overview]
Message-ID: <20260226013534.2028272-3-irogers@google.com> (raw)
In-Reply-To: <20260226013534.2028272-1-irogers@google.com>
For logging and debug messages it can be convenient to convert a
feature number to a name. Add header_feat__name for this and reuse the
data already within the feat_ops struct.
Signed-off-by: Ian Rogers <irogers@google.com>
---
| 7 +++++++
| 2 ++
2 files changed, 9 insertions(+)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 9142a8ba4019..fe5d21dde04f 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -3770,6 +3770,13 @@ struct header_print_data {
bool full; /* extended list of headers */
};
+const char *header_feat__name(unsigned int id)
+{
+ if (id < HEADER_LAST_FEATURE)
+ return feat_ops[id].name;
+ return "INVALID";
+}
+
static int perf_file_section__fprintf_info(struct perf_file_section *section,
struct perf_header *ph,
int feat, int fd, void *data)
--git a/tools/perf/util/header.h b/tools/perf/util/header.h
index cc40ac796f52..ca22030a1434 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -132,6 +132,8 @@ struct perf_header_feature_ops {
extern const char perf_version_string[];
+const char *header_feat__name(unsigned int id);
+
int perf_session__read_header(struct perf_session *session);
int perf_session__write_header(struct perf_session *session,
struct evlist *evlist,
--
2.53.0.414.gf7e9f6c205-goog
next prev parent reply other threads:[~2026-02-26 1:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 1:35 [PATCH v1 0/5] perf data/pipe handling improvements Ian Rogers
2026-02-26 1:35 ` [PATCH v1 1/5] perf clockid: Add missing include Ian Rogers
2026-02-26 1:35 ` Ian Rogers [this message]
2026-02-26 1:35 ` [PATCH v1 3/5] perf session: Extra logging for failed to process events Ian Rogers
2026-02-26 6:46 ` Namhyung Kim
2026-02-26 1:35 ` [PATCH v1 4/5] perf header: Refactor pipe mode end marker handling Ian Rogers
2026-02-26 6:50 ` Namhyung Kim
2026-02-26 1:35 ` [PATCH v1 5/5] perf evsel: Make unknown event names more unique Ian Rogers
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=20260226013534.2028272-3-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ashelat@redhat.com \
--cc=ctshao@google.com \
--cc=derek.foreman@collabora.com \
--cc=howardchu95@gmail.com \
--cc=hrishikesh123s@gmail.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@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=swapnil.sapkal@amd.com \
--cc=thomas.falcon@intel.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