Re: [PATCH 05/11] perf, tools: Add support for reading JSON event files
> On powerpc our event names are always uppercase, it would be nice if the perf > list output honoured that. > > Can we instead just honour whatever case is in the input JSON ? Intel events are upper case too. However perf is not into shouting in general, so I chose to lower everything. > > It looks like the event lookup is already case insensitive. Yes if you want you can specify them upper case. -Andi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/11] perf, tools: Add support for reading JSON event files
On powerpc our event names are always uppercase, it would be nice if the perf list output honoured that. Can we instead just honour whatever case is in the input JSON ? Intel events are upper case too. However perf is not into shouting in general, so I chose to lower everything. It looks like the event lookup is already case insensitive. Yes if you want you can specify them upper case. -Andi -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/11] perf, tools: Add support for reading JSON event files
On Fri, 2014-07-11 at 16:59 -0700, Andi Kleen wrote: > From: Andi Kleen > > Add a parser for Intel style JSON event files. This allows > to use an Intel event list directly with perf. The Intel > event lists can be quite large and are too big to store > in unswappable kernel memory. ... > diff --git a/tools/perf/util/jevents.c b/tools/perf/util/jevents.c > new file mode 100644 > index 000..a23f57f > --- /dev/null > +++ b/tools/perf/util/jevents.c > @@ -0,0 +1,246 @@ ... > + > +static void fixname(char *s) > +{ > + for (; *s; s++) > + *s = tolower(*s); > +} On powerpc our event names are always uppercase, it would be nice if the perf list output honoured that. Can we instead just honour whatever case is in the input JSON ? It looks like the event lookup is already case insensitive. cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/11] perf, tools: Add support for reading JSON event files
On Fri, 2014-07-11 at 16:59 -0700, Andi Kleen wrote: From: Andi Kleen a...@linux.intel.com Add a parser for Intel style JSON event files. This allows to use an Intel event list directly with perf. The Intel event lists can be quite large and are too big to store in unswappable kernel memory. ... diff --git a/tools/perf/util/jevents.c b/tools/perf/util/jevents.c new file mode 100644 index 000..a23f57f --- /dev/null +++ b/tools/perf/util/jevents.c @@ -0,0 +1,246 @@ ... + +static void fixname(char *s) +{ + for (; *s; s++) + *s = tolower(*s); +} On powerpc our event names are always uppercase, it would be nice if the perf list output honoured that. Can we instead just honour whatever case is in the input JSON ? It looks like the event lookup is already case insensitive. cheers -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/11] perf, tools: Add support for reading JSON event files
From: Andi Kleen Add a parser for Intel style JSON event files. This allows to use an Intel event list directly with perf. The Intel event lists can be quite large and are too big to store in unswappable kernel memory. The parser code knows how to convert the JSON fields to perf fields. The conversion code is straight forward. It knows (very little) Intel specific information, and can be easily extended to handle fields for other CPUs. The parser code is partially shared with an independent parsing library, which is 2-clause BSD licenced. To avoid any conflicts I marked those files as BSD licenced too. As part of perf they become GPLv2. The events are handled using the existing alias machinery. We output the BriefDescription in perf list. Right now the json file can be specified as an argument to perf stat/record/list. Followon patches will automate this. JSON files look like this: [ { "EventCode": "0x00", "UMask": "0x01", "EventName": "INST_RETIRED.ANY", "BriefDescription": "Instructions retired from execution.", "PublicDescription": "Instructions retired from execution.", "Counter": "Fixed counter 1", "CounterHTOff": "Fixed counter 1", "SampleAfterValue": "203", "MSRIndex": "0", "MSRValue": "0", "TakenAlone": "0", "CounterMask": "0", "Invert": "0", "AnyThread": "0", "EdgeDetect": "0", "PEBS": "0", "PRECISE_STORE": "0", "Errata": "null", "Offcore": "0" } ] v2: Address review feedback. Rename option to --event-files v3: Add JSON example v4: Update manpages. v5: Don't remove dot in fixname. Fix compile error. Add include protection. Comment realloc. Acked-by: Namhyung Kim Signed-off-by: Andi Kleen --- tools/perf/Documentation/perf-list.txt | 12 +- tools/perf/Documentation/perf-record.txt | 8 +- tools/perf/Documentation/perf-stat.txt | 8 +- tools/perf/Makefile.perf | 2 + tools/perf/builtin-list.c| 2 + tools/perf/builtin-record.c | 3 + tools/perf/builtin-stat.c| 2 + tools/perf/util/jevents.c| 246 +++ tools/perf/util/jevents.h| 8 + tools/perf/util/pmu.c| 14 ++ tools/perf/util/pmu.h| 2 + 11 files changed, 303 insertions(+), 4 deletions(-) create mode 100644 tools/perf/util/jevents.c create mode 100644 tools/perf/util/jevents.h diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 6fce6a6..da03992 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -15,8 +15,16 @@ DESCRIPTION This command displays the symbolic event types which can be selected in the various perf commands with the -e option. -[[EVENT_MODIFIERS]] -EVENT MODIFIERS +OPTIONS +--- +--events-file=:: +Specify JSON event list file to use for parsing events. Files can be +automatically downloaded with perf download. +The JSON event file can be also specified with the EVENTMAP environment +variable. + + +[[EVENT_MODIFIERS]] EVENT MODIFIERS --- Events can optionally have a modifer by appending a colon and one or diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index d460049..62c27fc 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -214,6 +214,12 @@ if combined with -a or -C options. After starting the program, wait msecs before measuring. This is useful to filter out the startup phase of the program, which is often very different. +--events-file=:: +Specify JSON event list file to use for parsing events. Must be specified +before the -e option. Files can be automatically downloaded with perf download. +The JSON event file can be also specified with the EVENTMAP environment +variable. + SEE ALSO -linkperf:perf-stat[1], linkperf:perf-list[1] +linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-download[1] diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 29ee857..cd9b62f 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -142,6 +142,12 @@ filter out the startup phase of the program, which is often very different. Print statistics of transactional execution if supported. +--events-file=:: +Specify JSON event list file to use for parsing events. Must be specified before +the -e option. Files can be automatically downloaded with perf download. +The JSON event file can be also specified with the EVENTMAP environment +variable. + EXAMPLES @@ -162,4 +168,4 @@ $ perf stat -- make -j SEE ALSO -linkperf:perf-top[1], linkperf:perf-list[1] +linkperf:perf-top[1], linkperf:perf-list[1], linkperf:perf-download[1] diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 1cd32c5..0016d1a 100644 ---
[PATCH 05/11] perf, tools: Add support for reading JSON event files
From: Andi Kleen a...@linux.intel.com Add a parser for Intel style JSON event files. This allows to use an Intel event list directly with perf. The Intel event lists can be quite large and are too big to store in unswappable kernel memory. The parser code knows how to convert the JSON fields to perf fields. The conversion code is straight forward. It knows (very little) Intel specific information, and can be easily extended to handle fields for other CPUs. The parser code is partially shared with an independent parsing library, which is 2-clause BSD licenced. To avoid any conflicts I marked those files as BSD licenced too. As part of perf they become GPLv2. The events are handled using the existing alias machinery. We output the BriefDescription in perf list. Right now the json file can be specified as an argument to perf stat/record/list. Followon patches will automate this. JSON files look like this: [ { EventCode: 0x00, UMask: 0x01, EventName: INST_RETIRED.ANY, BriefDescription: Instructions retired from execution., PublicDescription: Instructions retired from execution., Counter: Fixed counter 1, CounterHTOff: Fixed counter 1, SampleAfterValue: 203, MSRIndex: 0, MSRValue: 0, TakenAlone: 0, CounterMask: 0, Invert: 0, AnyThread: 0, EdgeDetect: 0, PEBS: 0, PRECISE_STORE: 0, Errata: null, Offcore: 0 } ] v2: Address review feedback. Rename option to --event-files v3: Add JSON example v4: Update manpages. v5: Don't remove dot in fixname. Fix compile error. Add include protection. Comment realloc. Acked-by: Namhyung Kim namhy...@kernel.org Signed-off-by: Andi Kleen a...@linux.intel.com --- tools/perf/Documentation/perf-list.txt | 12 +- tools/perf/Documentation/perf-record.txt | 8 +- tools/perf/Documentation/perf-stat.txt | 8 +- tools/perf/Makefile.perf | 2 + tools/perf/builtin-list.c| 2 + tools/perf/builtin-record.c | 3 + tools/perf/builtin-stat.c| 2 + tools/perf/util/jevents.c| 246 +++ tools/perf/util/jevents.h| 8 + tools/perf/util/pmu.c| 14 ++ tools/perf/util/pmu.h| 2 + 11 files changed, 303 insertions(+), 4 deletions(-) create mode 100644 tools/perf/util/jevents.c create mode 100644 tools/perf/util/jevents.h diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 6fce6a6..da03992 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -15,8 +15,16 @@ DESCRIPTION This command displays the symbolic event types which can be selected in the various perf commands with the -e option. -[[EVENT_MODIFIERS]] -EVENT MODIFIERS +OPTIONS +--- +--events-file=:: +Specify JSON event list file to use for parsing events. Files can be +automatically downloaded with perf download. +The JSON event file can be also specified with the EVENTMAP environment +variable. + + +[[EVENT_MODIFIERS]] EVENT MODIFIERS --- Events can optionally have a modifer by appending a colon and one or diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index d460049..62c27fc 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -214,6 +214,12 @@ if combined with -a or -C options. After starting the program, wait msecs before measuring. This is useful to filter out the startup phase of the program, which is often very different. +--events-file=:: +Specify JSON event list file to use for parsing events. Must be specified +before the -e option. Files can be automatically downloaded with perf download. +The JSON event file can be also specified with the EVENTMAP environment +variable. + SEE ALSO -linkperf:perf-stat[1], linkperf:perf-list[1] +linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-download[1] diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 29ee857..cd9b62f 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -142,6 +142,12 @@ filter out the startup phase of the program, which is often very different. Print statistics of transactional execution if supported. +--events-file=:: +Specify JSON event list file to use for parsing events. Must be specified before +the -e option. Files can be automatically downloaded with perf download. +The JSON event file can be also specified with the EVENTMAP environment +variable. + EXAMPLES @@ -162,4 +168,4 @@ $ perf stat -- make -j SEE ALSO -linkperf:perf-top[1], linkperf:perf-list[1] +linkperf:perf-top[1], linkperf:perf-list[1], linkperf:perf-download[1] diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 1cd32c5..0016d1a 100644 ---