perf tools: Unify event type description

make event type description to a unified array and
the array index consistent to perf_type_id.

Signed-off-by: Liming Wang <liming.wang@windriver.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1262075829-16257-1-git-send-email-liming.wang@windriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Liming Wang 2009-12-29 16:37:07 +08:00 committed by Ingo Molnar
parent 9967411e5b
commit 41bdcb23da
1 changed files with 10 additions and 9 deletions

View File

@ -835,11 +835,12 @@ int parse_filter(const struct option *opt __used, const char *str,
} }
static const char * const event_type_descriptors[] = { static const char * const event_type_descriptors[] = {
"",
"Hardware event", "Hardware event",
"Software event", "Software event",
"Tracepoint event", "Tracepoint event",
"Hardware cache event", "Hardware cache event",
"Raw hardware event descriptor",
"Hardware breakpoint",
}; };
/* /*
@ -872,7 +873,7 @@ static void print_tracepoint_events(void)
snprintf(evt_path, MAXPATHLEN, "%s:%s", snprintf(evt_path, MAXPATHLEN, "%s:%s",
sys_dirent.d_name, evt_dirent.d_name); sys_dirent.d_name, evt_dirent.d_name);
printf(" %-42s [%s]\n", evt_path, printf(" %-42s [%s]\n", evt_path,
event_type_descriptors[PERF_TYPE_TRACEPOINT+1]); event_type_descriptors[PERF_TYPE_TRACEPOINT]);
} }
closedir(evt_dir); closedir(evt_dir);
} }
@ -892,9 +893,7 @@ void print_events(void)
printf("List of pre-defined events (to be used in -e):\n"); printf("List of pre-defined events (to be used in -e):\n");
for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) { for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
type = syms->type + 1; type = syms->type;
if (type >= ARRAY_SIZE(event_type_descriptors))
type = 0;
if (type != prev_type) if (type != prev_type)
printf("\n"); printf("\n");
@ -919,17 +918,19 @@ void print_events(void)
for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
printf(" %-42s [%s]\n", printf(" %-42s [%s]\n",
event_cache_name(type, op, i), event_cache_name(type, op, i),
event_type_descriptors[4]); event_type_descriptors[PERF_TYPE_HW_CACHE]);
} }
} }
} }
printf("\n"); printf("\n");
printf(" %-42s [raw hardware event descriptor]\n", printf(" %-42s [%s]\n",
"rNNN"); "rNNN", event_type_descriptors[PERF_TYPE_RAW]);
printf("\n"); printf("\n");
printf(" %-42s [hardware breakpoint]\n", "mem:<addr>[:access]"); printf(" %-42s [%s]\n",
"mem:<addr>[:access]",
event_type_descriptors[PERF_TYPE_BREAKPOINT]);
printf("\n"); printf("\n");
print_tracepoint_events(); print_tracepoint_events();