aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-30 14:12:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-30 14:12:00 -0400
commit65a50c951a38e9827dd9655b6e686bde912e799b (patch)
treecce85e74511741d52069977fee6984ce66c9277c /tools/perf/util/parse-events.c
parent42fe55ce905212542426fa6407a76534a5fb696a (diff)
parent59cd358a7a5b2f6b61faa01dae6cfda3830ac62a (diff)
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar. * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits) perf ui browser: Stop using 'self' perf annotate browser: Read perf config file for settings perf config: Allow '_' in config file variable names perf annotate browser: Make feature toggles global perf annotate browser: The idx_asm field should be used in asm only view perf tools: Convert critical messages to ui__error() perf ui: Make --stdio default when TUI is not supported tools lib traceevent: Silence compiler warning on 32bit build perf record: Fix branch_stack type in perf_record_opts perf tools: Reconstruct event with modifiers from perf_event_attr perf top: Fix counter name fixup when fallbacking to cpu-clock perf tools: fix thread_map__new_by_pid_str() memory leak in error path perf tools: Do not use _FORTIFY_SOURCE when DEBUG=1 is specified tools lib traceevent: Fix signature of create_arg_item() tools lib traceevent: Use proper function parameter type tools lib traceevent: Fix freeing arg on process_dynamic_array() tools lib traceevent: Fix a possibly wrong memory dereference tools lib traceevent: Fix a possible memory leak tools lib traceevent: Allow expressions in __print_symbolic() fields perf evlist: Explicititely initialize input_name ...
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;