Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1234619
| From | Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v17 18/19] perf, tools, pmu-events: Fix fixed counters on Intel |
| Date | 2015-09-29 03:00 +0200 |
| Message-ID | <qdRqX-7CL-37@gated-at.bofh.it> (permalink) |
| References | <qdRqW-7CL-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Andi Kleen <ak@linux.intel.com>
The JSON event lists use a different encoding for fixed counters
than perf for instructions and cycles (ref-cycles is ok)
This lead to some common events like inst_retired.any
or cpu_clk_unhalted.thread not counting, when specified with their
JSON name.
Special case these events in the jevents conversion process.
I prefer to not touch the JSON files for this, as it's intended
that standard JSON files can be just dropped into the perf
build without changes.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
[Fix minor compile error]
---
tools/perf/pmu-events/jevents.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 7347cca..247d777e 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -237,6 +237,28 @@ static void print_events_table_suffix(FILE *outfp)
fprintf(outfp, "};\n");
}
+static struct fixed {
+ const char *name;
+ const char *event;
+} fixed[] = {
+ { "inst_retired.any", "event=0xc0" },
+ { "cpu_clk_unhalted.thread", "event=0x3c" },
+ { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" },
+ { NULL, NULL},
+};
+
+/*
+ * Handle different fixed counter encodings between JSON and perf.
+ */
+static char *real_event(const char *name, char *event)
+{
+ int i;
+ for (i = 0; fixed[i].name; i++)
+ if (!strcasecmp(name, fixed[i].name))
+ return (char *)fixed[i].event;
+ return event;
+}
+
/* Call func with each event in the json file */
int json_events(const char *fn,
int (*func)(void *data, char *name, char *event, char *desc,
@@ -324,8 +346,7 @@ int json_events(const char *fn,
if (msr != NULL)
addfield(map, &event, ",", msr->pname, msrval);
fixname(name);
-
- err = func(data, name, event, desc, long_desc, topic);
+ err = func(data, name, real_event(name, event), desc, long_desc, topic);
free(event);
free(desc);
free(name);
--
2.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v17 00/19] perf, tools: Add support for PMU events in JSON format Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 04/19] perf, tools: Support CPU ID matching for Powerpc Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 07/19] perf, tools: Query terminal width and use in perf list Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 06/19] perf, tools: Support alias descriptions Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 02/19] perf, tools, jevents: Program to convert JSON file to C style file Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 18/19] perf, tools, pmu-events: Fix fixed counters on Intel Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 12/19] perf, tools: Support long descriptions with perf list Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 03/19] perf, tools: Use pmu_events table to create aliases Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200 [PATCH v17 01/19] perf, tools: Add jsmn `jasmine' JSON parser Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-09-29 03:00 +0200
csiph-web