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.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index c8f8cf4a6920..641c4ac8a838 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -62,18 +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 *sw_event_names[PERF_COUNT_SW_MAX] = {
66 "cpu-clock",
67 "task-clock",
68 "page-faults",
69 "context-switches",
70 "CPU-migrations",
71 "minor-faults",
72 "major-faults",
73 "alignment-faults",
74 "emulation-faults",
75};
76
77#define for_each_subsystem(sys_dir, sys_dirent, sys_next) \ 65#define for_each_subsystem(sys_dir, sys_dirent, sys_next) \
78 while (!readdir_r(sys_dir, &sys_dirent, &sys_next) && sys_next) \ 66 while (!readdir_r(sys_dir, &sys_dirent, &sys_next) && sys_next) \
79 if (sys_dirent.d_type == DT_DIR && \ 67 if (sys_dirent.d_type == DT_DIR && \
@@ -218,7 +206,8 @@ const char *event_name(struct perf_evsel *evsel)
218 u64 config = evsel->attr.config; 206 u64 config = evsel->attr.config;
219 int type = evsel->attr.type; 207 int type = evsel->attr.type;
220 208
221 if (type == PERF_TYPE_RAW || type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE) { 209 if (type == PERF_TYPE_RAW || type == PERF_TYPE_HARDWARE ||
210 type == PERF_TYPE_SOFTWARE || type == PERF_TYPE_HW_CACHE) {
222 /* 211 /*
223 * XXX minimal fix, see comment on perf_evsen__name, this static buffer 212 * XXX minimal fix, see comment on perf_evsen__name, this static buffer
224 * will go away together with event_name in the next devel cycle. 213 * will go away together with event_name in the next devel cycle.
@@ -252,9 +241,7 @@ const char *__event_name(int type, u64 config)
252 return buf; 241 return buf;
253 242
254 case PERF_TYPE_SOFTWARE: 243 case PERF_TYPE_SOFTWARE:
255 if (config < PERF_COUNT_SW_MAX && sw_event_names[config]) 244 return __perf_evsel__sw_name(config);
256 return sw_event_names[config];
257 return "unknown-software";
258 245
259 case PERF_TYPE_TRACEPOINT: 246 case PERF_TYPE_TRACEPOINT:
260 return tracepoint_id_to_name(config); 247 return tracepoint_id_to_name(config);