From: Andi Kleen <andi@firstfloor.org>
To: jolsa@redhat.com
Cc: linux-kernel@vger.kernel.org, namhyung@kernel.org,
acme@infradead.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 09/11] perf, tools: Add a new pmu interface to iterate over all events
Date: Fri, 11 Jul 2014 16:59:23 -0700 [thread overview]
Message-ID: <1405123165-22666-10-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1405123165-22666-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
With calling a callback. To be used in test code added in the next
patch.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/pmu.c | 18 ++++++++++++++++++
tools/perf/util/pmu.h | 2 ++
2 files changed, 20 insertions(+)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8714f9a..397e400 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -869,3 +869,21 @@ bool pmu_have_event(const char *pname, const char *name)
}
return false;
}
+
+int pmu_iterate_events(int (*func)(const char *pmu, const char *name))
+{
+ int ret = 0;
+ struct perf_pmu *pmu;
+ struct perf_pmu_alias *alias;
+
+ perf_pmu__find("cpu"); /* Load PMUs */
+ pmu = NULL;
+ while ((pmu = perf_pmu__scan(pmu)) != NULL) {
+ list_for_each_entry(alias, &pmu->aliases, list) {
+ ret = func(pmu->name, alias->name);
+ if (ret != 0)
+ break;
+ }
+ }
+ return ret;
+}
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 583d21e..87a1da4 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -47,5 +47,7 @@ bool pmu_have_event(const char *pname, const char *name);
int perf_pmu__test(void);
+int pmu_iterate_events(int (*func)(const char *, const char *name));
+
extern const char *json_file;
#endif /* __PMU_H */
--
1.9.3
next prev parent reply other threads:[~2014-07-12 0:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 23:59 perf: Add support for full Intel event lists v7 Andi Kleen
2014-07-11 23:59 ` [PATCH 01/11] perf, tools: Add jsmn `jasmine' JSON parser Andi Kleen
2014-07-11 23:59 ` [PATCH 02/11] perf, tools: Add support for text descriptions of events and alias add Andi Kleen
2014-07-11 23:59 ` [PATCH 03/11] perf, tools, list: Update perf list to output descriptions Andi Kleen
2014-07-11 23:59 ` [PATCH 04/11] perf, tools: Allow events with dot Andi Kleen
2014-07-11 23:59 ` [PATCH 05/11] perf, tools: Add support for reading JSON event files Andi Kleen
2014-07-18 5:29 ` Michael Ellerman
2014-07-18 17:40 ` Andi Kleen
2014-07-11 23:59 ` [PATCH 06/11] perf, tools: Automatically look for event file name for cpu Andi Kleen
2014-07-18 6:43 ` Michael Ellerman
2014-07-11 23:59 ` [PATCH 07/11] perf, tools: Add perf download to download event files Andi Kleen
2014-07-18 6:28 ` Michael Ellerman
2014-07-11 23:59 ` [PATCH 08/11] perf, tools: Query terminal width and use in perf list Andi Kleen
2014-07-11 23:59 ` Andi Kleen [this message]
2014-07-11 23:59 ` [PATCH 10/11] perf, tools, test: Add test case for alias and JSON parsing Andi Kleen
2014-07-12 23:10 ` Jiri Olsa
2014-07-12 23:49 ` Andi Kleen
2014-07-13 20:09 ` Jiri Olsa
2014-07-14 1:44 ` Andi Kleen
2014-07-11 23:59 ` [PATCH 11/11] perf, tools: Add a --no-desc flag to perf list Andi Kleen
2014-07-18 8:57 ` perf: Add support for full Intel event lists v7 Michael Ellerman
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=1405123165-22666-10-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=acme@infradead.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
/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
Powered by JetHome