diff options
Diffstat (limited to 'tools/perf/pmu-events')
-rw-r--r-- | tools/perf/pmu-events/jevents.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 13f4284721d5..04e106e799ac 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -306,6 +306,29 @@ static void print_events_table_suffix(FILE *outfp) close_table = 0; } +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, @@ -392,7 +415,7 @@ int json_events(const char *fn, addfield(map, &event, ",", msr->pname, msrval); fixname(name); - err = func(data, name, event, desc, long_desc); + err = func(data, name, real_event(name, event), desc, long_desc); free(event); free(desc); free(name); |