From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: mingo@redhat.com, ak@linux.intel.com,
Michael Ellerman <mpe@ellerman.id.au>,
Jiri Olsa <jolsa@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Paul Mackerras <paulus@samba.org>
Cc: namhyung@kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 0/4] perf: Add support for PMU events in JSON format
Date: Tue, 19 May 2015 17:02:06 -0700 [thread overview]
Message-ID: <1432080130-6678-1-git-send-email-sukadev@linux.vnet.ibm.com> (raw)
CPUs support a large number of performance monitoring events (PMU events)
and often these events are very specific to an architecture/model of the
CPU. To use most of these PMU events with perf we currently have to identify
the events by their raw codes:
perf stat -e r100f2 sleep 1
This patchset allows architectures to specify these PMU events in a JSON
files which are defined in the tools/perf/pmu-events/arch/ directory of
the mainline tree
Eg: snippet from 004d0100.json (in patch 4)
[
{
"EventCode": "0x100f2",
"EventName": "PM_1PLUS_PPC_CMPL",
"BriefDescription": "1 or more ppc insts finished,",
"PublicDescription": "1 or more ppc insts finished (completed).,"
},
]
When building the perf tool, this patchset, first builds/uses a 'jevents'
which locates all the JSON files for the architecture (currently Powerpc).
The jevents binary then translates the JSON files into into a C-style
"PMU events table":
struct pmu_event pme_004d0100_core[] = {
...
{
.name = "pm_1plus_ppc_cmpl",
.event = "event=0x100f2",
.desc = "1 or more ppc insts finished,",
},
...
}
The jevents binary also looks for a "mapfile" to map a processor model/
version to a specific events table:
$ cat mapfile.csv
IBM-Power8-9188,004d0100,004d0100-core.json,core
and uses this to build a mapping table:
struct pmu_events_map pmu_events_map[] = {
{
.vfm = "IBM-Power8-9188",
.version = "004d0100",
.type = "core",
.table = pme_004d0100_core
},
This mapping and events tables for the architecture are then included in
the perf binary during build.
At run time, perf identifies the specific events table, based on the model
of the CPU perf is running on. Perf uses that table to create event aliases
which would allow the user to specify the event as:
perf stat -e pm_1plus_ppc_cmpl sleep 1
Note:
- All known events tables for the architecture are included in the
perf binary.
- Inconsistencies between the JSON files and the mapfile can result
in build failures in perf (although jevents try to recover from
some and continue the build by leaving out event aliases).
- For architectures that don't have any JSON files, an empty mapping
table is created and they should continue to build)
Andi Kleen (2):
perf, tools: Add jsmn `jasmine' JSON parser
jevents: Program to convert JSON file to C style file
Sukadev Bhattiprolu (2):
Use pmu_events_map table to create event aliases
perf: Add power8 PMU events in json format
tools/perf/Build | 1 +
tools/perf/Makefile.perf | 4 +-
tools/perf/arch/powerpc/util/header.c | 33 +
tools/perf/pmu-events/Build | 38 +
tools/perf/pmu-events/README | 67 +
.../pmu-events/arch/powerpc/004d0100-core.json | 5766 ++++++++++++++++++++
tools/perf/pmu-events/arch/powerpc/mapfile.csv | 1 +
tools/perf/pmu-events/arch/powerpc/power8.json | 5766 ++++++++++++++++++++
tools/perf/pmu-events/jevents.c | 700 +++
tools/perf/pmu-events/jevents.h | 17 +
tools/perf/pmu-events/jsmn.c | 313 ++
tools/perf/pmu-events/jsmn.h | 67 +
tools/perf/pmu-events/json.c | 162 +
tools/perf/pmu-events/json.h | 36 +
tools/perf/pmu-events/pmu-events.h | 39 +
tools/perf/util/header.h | 4 +-
tools/perf/util/pmu.c | 104 +-
17 files changed, 13103 insertions(+), 15 deletions(-)
create mode 100644 tools/perf/pmu-events/Build
create mode 100644 tools/perf/pmu-events/README
create mode 100644 tools/perf/pmu-events/arch/powerpc/004d0100-core.json
create mode 100644 tools/perf/pmu-events/arch/powerpc/mapfile.csv
create mode 100644 tools/perf/pmu-events/arch/powerpc/power8.json
create mode 100644 tools/perf/pmu-events/jevents.c
create mode 100644 tools/perf/pmu-events/jevents.h
create mode 100644 tools/perf/pmu-events/jsmn.c
create mode 100644 tools/perf/pmu-events/jsmn.h
create mode 100644 tools/perf/pmu-events/json.c
create mode 100644 tools/perf/pmu-events/json.h
create mode 100644 tools/perf/pmu-events/pmu-events.h
--
1.7.9.5
next reply other threads:[~2015-05-20 0:02 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 0:02 Sukadev Bhattiprolu [this message]
2015-05-20 0:02 ` [PATCH 1/4] perf: Add jsmn `jasmine' JSON parser Sukadev Bhattiprolu
2015-05-20 0:02 ` [PATCH 2/4] perf: jevents: Program to convert JSON file to C style file Sukadev Bhattiprolu
2015-05-22 14:56 ` Jiri Olsa
2015-05-22 15:58 ` Sukadev Bhattiprolu
2015-05-22 17:33 ` Jiri Olsa
2015-05-22 18:01 ` Andi Kleen
2015-05-22 18:09 ` Sukadev Bhattiprolu
2015-05-22 21:28 ` Andi Kleen
2015-05-22 14:56 ` Jiri Olsa
2015-05-22 17:25 ` Sukadev Bhattiprolu
2015-05-27 13:54 ` Namhyung Kim
2015-05-27 14:40 ` Andi Kleen
2015-05-27 14:59 ` Namhyung Kim
2015-05-28 11:52 ` Jiri Olsa
2015-05-28 12:09 ` Ingo Molnar
2015-05-28 13:07 ` Ingo Molnar
2015-05-28 15:39 ` Andi Kleen
2015-05-29 7:27 ` Ingo Molnar
2015-05-31 16:07 ` Andi Kleen
2015-05-20 0:02 ` [PATCH 3/4] perf: Use pmu_events_map table to create event aliases Sukadev Bhattiprolu
2015-05-20 23:58 ` Andi Kleen
2015-05-21 0:19 ` Sukadev Bhattiprolu
2015-05-21 2:56 ` Andi Kleen
2015-05-21 5:02 ` Sukadev Bhattiprolu
2015-05-21 18:50 ` Andi Kleen
2015-05-20 0:02 ` [PATCH 4/4] perf: Add power8 PMU events in JSON format Sukadev Bhattiprolu
2015-05-27 13:59 ` Namhyung Kim
2015-05-27 14:41 ` Andi Kleen
2015-05-27 15:01 ` Namhyung Kim
2015-05-27 16:24 ` Andi Kleen
2015-05-27 20:24 ` Sukadev Bhattiprolu
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=1432080130-6678-1-git-send-email-sukadev@linux.vnet.ibm.com \
--to=sukadev@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=namhyung@kernel.org \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).