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 <ashwinc@codeaurora.org>
This commit is contained in:
Ashwin Chaugule 2012-09-20 10:53:42 -04:00
parent e7183bb6e2
commit 3d0945d3f4

View file

@ -308,7 +308,7 @@ const char *__event_name(int type, u64 config, char *pmu_name)
{ {
static char buf[32]; static char buf[32];
if (type == PERF_TYPE_RAW) { if (!pmu_name && type == PERF_TYPE_RAW) {
sprintf(buf, "raw 0x%" PRIx64, config); sprintf(buf, "raw 0x%" PRIx64, config);
return buf; return buf;
} }
@ -684,6 +684,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
{ {
struct perf_event_attr attr; struct perf_event_attr attr;
struct perf_pmu *pmu; struct perf_pmu *pmu;
char *ev_name;
pmu = perf_pmu__find(name); pmu = perf_pmu__find(name);
if (!pmu) 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)) if (perf_pmu__config(pmu, &attr, head_config))
return -EINVAL; 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, void parse_events_update_lists(struct list_head *list_event,