From: Ravi Bangoria <ravi.bangoria@amd.com>
To: <acme@kernel.org>
Cc: <ravi.bangoria@amd.com>, <kan.liang@linux.intel.com>,
<irogers@google.com>, <jolsa@redhat.com>, <namhyung@kernel.org>,
<peterz@infradead.org>, <mark.rutland@arm.com>,
<adrian.hunter@intel.com>, <alexander.shishkin@linux.intel.com>,
<carsten.haitzler@arm.com>, <leo.yan@linaro.org>,
<maddy@linux.ibm.com>, <kjain@linux.ibm.com>,
<atrajeev@linux.vnet.ibm.com>, <tmricht@linux.ibm.com>,
<linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <sandipan.das@amd.com>,
<ananth.narayan@amd.com>, <santosh.shukla@amd.com>
Subject: [PATCH v3 1/2] perf tool: Move pmus list variable to new a file
Date: Tue, 6 Dec 2022 10:02:36 +0530 [thread overview]
Message-ID: <20221206043237.12159-2-ravi.bangoria@amd.com> (raw)
In-Reply-To: <20221206043237.12159-1-ravi.bangoria@amd.com>
pmus list variable is defined as static variable under pmu.c file.
Introduce new file pmus.c and migrate this variable to it. Also make
it non static so that it can be accessed from outside.
Suggested-by: Ian Rogers <irogers@google.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/util/Build | 1 +
tools/perf/util/pmu.c | 2 +-
tools/perf/util/pmus.c | 5 +++++
tools/perf/util/pmus.h | 9 +++++++++
4 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 tools/perf/util/pmus.c
create mode 100644 tools/perf/util/pmus.h
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index ab37f588ee8b..d04802bfa23f 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -73,6 +73,7 @@ perf-y += trace-event-parse.o
perf-y += parse-events-flex.o
perf-y += parse-events-bison.o
perf-y += pmu.o
+perf-y += pmus.o
perf-y += pmu-flex.o
perf-y += pmu-bison.o
perf-y += pmu-hybrid.o
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index e9a4f31926bf..f5e10f41c042 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -22,6 +22,7 @@
#include "debug.h"
#include "evsel.h"
#include "pmu.h"
+#include "pmus.h"
#include "parse-events.h"
#include "print-events.h"
#include "header.h"
@@ -58,7 +59,6 @@ struct perf_pmu_format {
int perf_pmu_parse(struct list_head *list, char *name);
extern FILE *perf_pmu_in;
-static LIST_HEAD(pmus);
static bool hybrid_scanned;
/*
diff --git a/tools/perf/util/pmus.c b/tools/perf/util/pmus.c
new file mode 100644
index 000000000000..7f3b93c4d229
--- /dev/null
+++ b/tools/perf/util/pmus.c
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/list.h>
+#include <pmus.h>
+
+LIST_HEAD(pmus);
diff --git a/tools/perf/util/pmus.h b/tools/perf/util/pmus.h
new file mode 100644
index 000000000000..5ec12007eb5c
--- /dev/null
+++ b/tools/perf/util/pmus.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PMUS_H
+#define __PMUS_H
+
+extern struct list_head pmus;
+
+#define perf_pmus__for_each_pmu(pmu) list_for_each_entry(pmu, &pmus, list)
+
+#endif /* __PMUS_H */
--
2.38.1
next prev parent reply other threads:[~2022-12-06 4:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 4:32 [PATCH v3 0/2] perf test: Add event group test Ravi Bangoria
2022-12-06 4:32 ` Ravi Bangoria [this message]
2022-12-06 4:32 ` [PATCH v3 2/2] " Ravi Bangoria
2022-12-06 6:17 ` Madhavan Srinivasan
2022-12-06 17:27 ` Athira Rajeev
2022-12-07 4:26 ` Ravi Bangoria
2022-12-07 5:31 ` Madhavan Srinivasan
2022-12-07 5:54 ` Ravi Bangoria
2022-12-06 5:02 ` [PATCH v3 0/2] " Ian Rogers
2022-12-06 14:47 ` Liang, Kan
2022-12-06 16:03 ` 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=20221206043237.12159-2-ravi.bangoria@amd.com \
--to=ravi.bangoria@amd.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=carsten.haitzler@arm.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=sandipan.das@amd.com \
--cc=santosh.shukla@amd.com \
--cc=tmricht@linux.ibm.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
all inboxes | Powered by JetHome®