aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter/util/parse-events.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-06-06 06:24:17 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-06 08:16:49 -0400
commit86847b62f0781ccc97a79936c9ed9dc818cff67b (patch)
treea55a8ea4a3e2c771322edc7aa01b1572c3a59c06 /Documentation/perf_counter/util/parse-events.c
parent8326f44da090d6d304d29b9fdc7fb3e20889e329 (diff)
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.c46
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:
274 return 0; 274 return 0;
275} 275}
276 276
277static const char * const event_type_descriptors[] = {
278 "",
279 "Hardware event",
280 "Software event",
281 "Tracepoint event",
282 "Hardware cache event",
283};
284
277/* 285/*
278 * Create the help text for the event symbols: 286 * Print the help text for the event symbols:
279 */ 287 */
280void create_events_help(char *events_help_msg) 288void print_events(void)
281{ 289{
282 unsigned int i; 290 struct event_symbol *syms = event_symbols;
283 char *str; 291 unsigned int i, type, prev_type = -1;
284 292
285 str = events_help_msg; 293 fprintf(stderr, "\n");
294 fprintf(stderr, "List of pre-defined events (to be used in -e):\n");
286 295
287 str += sprintf(str, 296 for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
288 "event name: ["); 297 type = syms->type + 1;
298 if (type > ARRAY_SIZE(event_type_descriptors))
299 type = 0;
289 300
290 for (i = 0; i < ARRAY_SIZE(event_symbols); i++) { 301 if (type != prev_type)
291 int type, id; 302 fprintf(stderr, "\n");
292
293 type = event_symbols[i].type;
294 id = event_symbols[i].config;
295 303
296 if (i) 304 fprintf(stderr, " %-30s [%s]\n", syms->symbol,
297 str += sprintf(str, "|"); 305 event_type_descriptors[type]);
298 306
299 str += sprintf(str, "%s", 307 prev_type = type;
300 event_symbols[i].symbol);
301 } 308 }
302 309
303 str += sprintf(str, "|rNNN]"); 310 fprintf(stderr, "\n");
311 fprintf(stderr, " %-30s [raw hardware event descriptor]\n",
312 "rNNN");
313 fprintf(stderr, "\n");
314
315 exit(129);
304} 316}