diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-06-06 12:24:17 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-06 14:16:49 +0200 |
commit | 86847b62f0781ccc97a79936c9ed9dc818cff67b (patch) | |
tree | a55a8ea4a3e2c771322edc7aa01b1572c3a59c06 /Documentation/perf_counter/util/parse-events.c | |
parent | 8326f44da090d6d304d29b9fdc7fb3e20889e329 (diff) | |
download | lwn-86847b62f0781ccc97a79936c9ed9dc818cff67b.tar.gz lwn-86847b62f0781ccc97a79936c9ed9dc818cff67b.zip |
perf_counter tools: Add 'perf list' to list available events
perf list: List all the available event types which can be used in
-e (--event) options.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/util/parse-events.c')
-rw-r--r-- | Documentation/perf_counter/util/parse-events.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/Documentation/perf_counter/util/parse-events.c b/Documentation/perf_counter/util/parse-events.c index de9a77c47151..150fbd262714 100644 --- a/Documentation/perf_counter/util/parse-events.c +++ b/Documentation/perf_counter/util/parse-events.c @@ -274,31 +274,43 @@ again: return 0; } +static const char * const event_type_descriptors[] = { + "", + "Hardware event", + "Software event", + "Tracepoint event", + "Hardware cache event", +}; + /* - * Create the help text for the event symbols: + * Print the help text for the event symbols: */ -void create_events_help(char *events_help_msg) +void print_events(void) { - unsigned int i; - char *str; + struct event_symbol *syms = event_symbols; + unsigned int i, type, prev_type = -1; - str = events_help_msg; + fprintf(stderr, "\n"); + fprintf(stderr, "List of pre-defined events (to be used in -e):\n"); - str += sprintf(str, - "event name: ["); + for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) { + type = syms->type + 1; + if (type > ARRAY_SIZE(event_type_descriptors)) + type = 0; - for (i = 0; i < ARRAY_SIZE(event_symbols); i++) { - int type, id; - - type = event_symbols[i].type; - id = event_symbols[i].config; + if (type != prev_type) + fprintf(stderr, "\n"); - if (i) - str += sprintf(str, "|"); + fprintf(stderr, " %-30s [%s]\n", syms->symbol, + event_type_descriptors[type]); - str += sprintf(str, "%s", - event_symbols[i].symbol); + prev_type = type; } - str += sprintf(str, "|rNNN]"); + fprintf(stderr, "\n"); + fprintf(stderr, " %-30s [raw hardware event descriptor]\n", + "rNNN"); + fprintf(stderr, "\n"); + + exit(129); } |