From 3d0945d3f4f9d0f5aba419a5acb405b57a7ea708 Mon Sep 17 00:00:00 2001 From: Ashwin Chaugule Date: Thu, 20 Sep 2012 10:53:42 -0400 Subject: [PATCH] Perf: Add event name to output If PMU's are accessed by names, this patch will make 'perf stat' also output the name of the event along with the PMU name. Change-Id: If62b5eaf8340c94c797644389cfd5d937b7a5a25 Signed-off-by: Ashwin Chaugule --- tools/perf/util/parse-events.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2d2b333de9c..4c6a5a47012 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -308,7 +308,7 @@ const char *__event_name(int type, u64 config, char *pmu_name) { static char buf[32]; - if (type == PERF_TYPE_RAW) { + if (!pmu_name && type == PERF_TYPE_RAW) { sprintf(buf, "raw 0x%" PRIx64, config); return buf; } @@ -684,6 +684,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx, { struct perf_event_attr attr; struct perf_pmu *pmu; + char *ev_name; pmu = perf_pmu__find(name); if (!pmu) @@ -700,7 +701,9 @@ int parse_events_add_pmu(struct list_head *list, int *idx, if (perf_pmu__config(pmu, &attr, head_config)) return -EINVAL; - return add_event(list, idx, &attr, pmu->name); + ev_name = (char *) __event_name(attr.type, attr.config, pmu->name); + + return add_event(list, idx, &attr, ev_name); } void parse_events_update_lists(struct list_head *list_event,