aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r--tools/perf/util/parse-events.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index fac7d59309b8..05dbc8b3c767 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -62,19 +62,6 @@ static struct event_symbol event_symbols[] = {
62#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE) 62#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
63#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT) 63#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)
64 64
65static const char *hw_event_names[PERF_COUNT_HW_MAX] = {
66 "cycles",
67 "instructions",
68 "cache-references",
69 "cache-misses",
70 "branches",
71 "branch-misses",
72 "bus-cycles",
73 "stalled-cycles-frontend",
74 "stalled-cycles-backend",
75 "ref-cycles",
76};
77
78static const char *sw_event_names[PERF_COUNT_SW_MAX] = { 65static const char *sw_event_names[PERF_COUNT_SW_MAX] = {
79 "cpu-clock", 66 "cpu-clock",
80 "task-clock", 67 "task-clock",
@@ -300,6 +287,16 @@ const char *event_name(struct perf_evsel *evsel)
300 u64 config = evsel->attr.config; 287 u64 config = evsel->attr.config;
301 int type = evsel->attr.type; 288 int type = evsel->attr.type;
302 289
290 if (type == PERF_TYPE_RAW || type == PERF_TYPE_HARDWARE) {
291 /*
292 * XXX minimal fix, see comment on perf_evsen__name, this static buffer
293 * will go away together with event_name in the next devel cycle.
294 */
295 static char bf[128];
296 perf_evsel__name(evsel, bf, sizeof(bf));
297 return bf;
298 }
299
303 if (evsel->name) 300 if (evsel->name)
304 return evsel->name; 301 return evsel->name;
305 302
@@ -317,9 +314,7 @@ const char *__event_name(int type, u64 config)
317 314
318 switch (type) { 315 switch (type) {
319 case PERF_TYPE_HARDWARE: 316 case PERF_TYPE_HARDWARE:
320 if (config < PERF_COUNT_HW_MAX && hw_event_names[config]) 317 return __perf_evsel__hw_name(config);
321 return hw_event_names[config];
322 return "unknown-hardware";
323 318
324 case PERF_TYPE_HW_CACHE: { 319 case PERF_TYPE_HW_CACHE: {
325 u8 cache_type, cache_op, cache_result; 320 u8 cache_type, cache_op, cache_result;