diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-06-11 13:36:20 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-06-19 12:06:20 -0400 |
commit | 335c2f5d25319b208fb8b444e6f3099a806a33bf (patch) | |
tree | b936f6b770a35e81a49465eb40edc8338745b341 /tools/perf/util/parse-events.c | |
parent | 0b668bc9a74ce1bd3b8c5fd93e8d85ed955e11fe (diff) |
perf tools: Reconstruct sw event with modifiers from perf_event_attr
[root@sandy ~]# perf record -e task-clock:u -a usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.482 MB perf.data (~21073 samples) ]
[root@sandy ~]#
Before:
[root@sandy ~]# perf evlist
task-clock
[root@sandy ~]#
After:
[root@sandy ~]# perf evlist
task-clock:u
[root@sandy ~]#
Ditto for other tools.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-97ltkmj7v23kyhflltf6iz5n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 19 |
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 | ||
65 | static 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); |