perf trace: Add filter Suppport
[linux-2.6/libata-dev.git] / tools / perf / util / parse-events.c
blobb097570e962331b410f654c0c2b827e862a51531
2 #include "util.h"
3 #include "../perf.h"
4 #include "parse-options.h"
5 #include "parse-events.h"
6 #include "exec_cmd.h"
7 #include "string.h"
8 #include "cache.h"
9 #include "header.h"
11 int nr_counters;
13 struct perf_event_attr attrs[MAX_COUNTERS];
14 char *filters[MAX_COUNTERS];
16 struct event_symbol {
17 u8 type;
18 u64 config;
19 const char *symbol;
20 const char *alias;
23 enum event_result {
24 EVT_FAILED,
25 EVT_HANDLED,
26 EVT_HANDLED_ALL
29 char debugfs_path[MAXPATHLEN];
31 #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
32 #define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
34 static struct event_symbol event_symbols[] = {
35 { CHW(CPU_CYCLES), "cpu-cycles", "cycles" },
36 { CHW(INSTRUCTIONS), "instructions", "" },
37 { CHW(CACHE_REFERENCES), "cache-references", "" },
38 { CHW(CACHE_MISSES), "cache-misses", "" },
39 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" },
40 { CHW(BRANCH_MISSES), "branch-misses", "" },
41 { CHW(BUS_CYCLES), "bus-cycles", "" },
43 { CSW(CPU_CLOCK), "cpu-clock", "" },
44 { CSW(TASK_CLOCK), "task-clock", "" },
45 { CSW(PAGE_FAULTS), "page-faults", "faults" },
46 { CSW(PAGE_FAULTS_MIN), "minor-faults", "" },
47 { CSW(PAGE_FAULTS_MAJ), "major-faults", "" },
48 { CSW(CONTEXT_SWITCHES), "context-switches", "cs" },
49 { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" },
52 #define __PERF_EVENT_FIELD(config, name) \
53 ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)
55 #define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
56 #define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG)
57 #define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
58 #define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)
60 static const char *hw_event_names[] = {
61 "cycles",
62 "instructions",
63 "cache-references",
64 "cache-misses",
65 "branches",
66 "branch-misses",
67 "bus-cycles",
70 static const char *sw_event_names[] = {
71 "cpu-clock-msecs",
72 "task-clock-msecs",
73 "page-faults",
74 "context-switches",
75 "CPU-migrations",
76 "minor-faults",
77 "major-faults",
80 #define MAX_ALIASES 8
82 static const char *hw_cache[][MAX_ALIASES] = {
83 { "L1-dcache", "l1-d", "l1d", "L1-data", },
84 { "L1-icache", "l1-i", "l1i", "L1-instruction", },
85 { "LLC", "L2" },
86 { "dTLB", "d-tlb", "Data-TLB", },
87 { "iTLB", "i-tlb", "Instruction-TLB", },
88 { "branch", "branches", "bpu", "btb", "bpc", },
91 static const char *hw_cache_op[][MAX_ALIASES] = {
92 { "load", "loads", "read", },
93 { "store", "stores", "write", },
94 { "prefetch", "prefetches", "speculative-read", "speculative-load", },
97 static const char *hw_cache_result[][MAX_ALIASES] = {
98 { "refs", "Reference", "ops", "access", },
99 { "misses", "miss", },
102 #define C(x) PERF_COUNT_HW_CACHE_##x
103 #define CACHE_READ (1 << C(OP_READ))
104 #define CACHE_WRITE (1 << C(OP_WRITE))
105 #define CACHE_PREFETCH (1 << C(OP_PREFETCH))
106 #define COP(x) (1 << x)
109 * cache operartion stat
110 * L1I : Read and prefetch only
111 * ITLB and BPU : Read-only
113 static unsigned long hw_cache_stat[C(MAX)] = {
114 [C(L1D)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
115 [C(L1I)] = (CACHE_READ | CACHE_PREFETCH),
116 [C(LL)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
117 [C(DTLB)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
118 [C(ITLB)] = (CACHE_READ),
119 [C(BPU)] = (CACHE_READ),
122 #define for_each_subsystem(sys_dir, sys_dirent, sys_next) \
123 while (!readdir_r(sys_dir, &sys_dirent, &sys_next) && sys_next) \
124 if (sys_dirent.d_type == DT_DIR && \
125 (strcmp(sys_dirent.d_name, ".")) && \
126 (strcmp(sys_dirent.d_name, "..")))
128 static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
130 char evt_path[MAXPATHLEN];
131 int fd;
133 snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
134 sys_dir->d_name, evt_dir->d_name);
135 fd = open(evt_path, O_RDONLY);
136 if (fd < 0)
137 return -EINVAL;
138 close(fd);
140 return 0;
143 #define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) \
144 while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next) \
145 if (evt_dirent.d_type == DT_DIR && \
146 (strcmp(evt_dirent.d_name, ".")) && \
147 (strcmp(evt_dirent.d_name, "..")) && \
148 (!tp_event_has_id(&sys_dirent, &evt_dirent)))
150 #define MAX_EVENT_LENGTH 512
152 int valid_debugfs_mount(const char *debugfs)
154 struct statfs st_fs;
156 if (statfs(debugfs, &st_fs) < 0)
157 return -ENOENT;
158 else if (st_fs.f_type != (long) DEBUGFS_MAGIC)
159 return -ENOENT;
160 return 0;
163 struct tracepoint_path *tracepoint_id_to_path(u64 config)
165 struct tracepoint_path *path = NULL;
166 DIR *sys_dir, *evt_dir;
167 struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
168 char id_buf[4];
169 int fd;
170 u64 id;
171 char evt_path[MAXPATHLEN];
172 char dir_path[MAXPATHLEN];
174 if (valid_debugfs_mount(debugfs_path))
175 return NULL;
177 sys_dir = opendir(debugfs_path);
178 if (!sys_dir)
179 return NULL;
181 for_each_subsystem(sys_dir, sys_dirent, sys_next) {
183 snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,
184 sys_dirent.d_name);
185 evt_dir = opendir(dir_path);
186 if (!evt_dir)
187 continue;
189 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
191 snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,
192 evt_dirent.d_name);
193 fd = open(evt_path, O_RDONLY);
194 if (fd < 0)
195 continue;
196 if (read(fd, id_buf, sizeof(id_buf)) < 0) {
197 close(fd);
198 continue;
200 close(fd);
201 id = atoll(id_buf);
202 if (id == config) {
203 closedir(evt_dir);
204 closedir(sys_dir);
205 path = calloc(1, sizeof(path));
206 path->system = malloc(MAX_EVENT_LENGTH);
207 if (!path->system) {
208 free(path);
209 return NULL;
211 path->name = malloc(MAX_EVENT_LENGTH);
212 if (!path->name) {
213 free(path->system);
214 free(path);
215 return NULL;
217 strncpy(path->system, sys_dirent.d_name,
218 MAX_EVENT_LENGTH);
219 strncpy(path->name, evt_dirent.d_name,
220 MAX_EVENT_LENGTH);
221 return path;
224 closedir(evt_dir);
227 closedir(sys_dir);
228 return NULL;
231 #define TP_PATH_LEN (MAX_EVENT_LENGTH * 2 + 1)
232 static const char *tracepoint_id_to_name(u64 config)
234 static char buf[TP_PATH_LEN];
235 struct tracepoint_path *path;
237 path = tracepoint_id_to_path(config);
238 if (path) {
239 snprintf(buf, TP_PATH_LEN, "%s:%s", path->system, path->name);
240 free(path->name);
241 free(path->system);
242 free(path);
243 } else
244 snprintf(buf, TP_PATH_LEN, "%s:%s", "unknown", "unknown");
246 return buf;
249 static int is_cache_op_valid(u8 cache_type, u8 cache_op)
251 if (hw_cache_stat[cache_type] & COP(cache_op))
252 return 1; /* valid */
253 else
254 return 0; /* invalid */
257 static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result)
259 static char name[50];
261 if (cache_result) {
262 sprintf(name, "%s-%s-%s", hw_cache[cache_type][0],
263 hw_cache_op[cache_op][0],
264 hw_cache_result[cache_result][0]);
265 } else {
266 sprintf(name, "%s-%s", hw_cache[cache_type][0],
267 hw_cache_op[cache_op][1]);
270 return name;
273 const char *event_name(int counter)
275 u64 config = attrs[counter].config;
276 int type = attrs[counter].type;
278 return __event_name(type, config);
281 const char *__event_name(int type, u64 config)
283 static char buf[32];
285 if (type == PERF_TYPE_RAW) {
286 sprintf(buf, "raw 0x%llx", config);
287 return buf;
290 switch (type) {
291 case PERF_TYPE_HARDWARE:
292 if (config < PERF_COUNT_HW_MAX)
293 return hw_event_names[config];
294 return "unknown-hardware";
296 case PERF_TYPE_HW_CACHE: {
297 u8 cache_type, cache_op, cache_result;
299 cache_type = (config >> 0) & 0xff;
300 if (cache_type > PERF_COUNT_HW_CACHE_MAX)
301 return "unknown-ext-hardware-cache-type";
303 cache_op = (config >> 8) & 0xff;
304 if (cache_op > PERF_COUNT_HW_CACHE_OP_MAX)
305 return "unknown-ext-hardware-cache-op";
307 cache_result = (config >> 16) & 0xff;
308 if (cache_result > PERF_COUNT_HW_CACHE_RESULT_MAX)
309 return "unknown-ext-hardware-cache-result";
311 if (!is_cache_op_valid(cache_type, cache_op))
312 return "invalid-cache";
314 return event_cache_name(cache_type, cache_op, cache_result);
317 case PERF_TYPE_SOFTWARE:
318 if (config < PERF_COUNT_SW_MAX)
319 return sw_event_names[config];
320 return "unknown-software";
322 case PERF_TYPE_TRACEPOINT:
323 return tracepoint_id_to_name(config);
325 default:
326 break;
329 return "unknown";
332 static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size)
334 int i, j;
335 int n, longest = -1;
337 for (i = 0; i < size; i++) {
338 for (j = 0; j < MAX_ALIASES && names[i][j]; j++) {
339 n = strlen(names[i][j]);
340 if (n > longest && !strncasecmp(*str, names[i][j], n))
341 longest = n;
343 if (longest > 0) {
344 *str += longest;
345 return i;
349 return -1;
352 static enum event_result
353 parse_generic_hw_event(const char **str, struct perf_event_attr *attr)
355 const char *s = *str;
356 int cache_type = -1, cache_op = -1, cache_result = -1;
358 cache_type = parse_aliases(&s, hw_cache, PERF_COUNT_HW_CACHE_MAX);
360 * No fallback - if we cannot get a clear cache type
361 * then bail out:
363 if (cache_type == -1)
364 return EVT_FAILED;
366 while ((cache_op == -1 || cache_result == -1) && *s == '-') {
367 ++s;
369 if (cache_op == -1) {
370 cache_op = parse_aliases(&s, hw_cache_op,
371 PERF_COUNT_HW_CACHE_OP_MAX);
372 if (cache_op >= 0) {
373 if (!is_cache_op_valid(cache_type, cache_op))
374 return 0;
375 continue;
379 if (cache_result == -1) {
380 cache_result = parse_aliases(&s, hw_cache_result,
381 PERF_COUNT_HW_CACHE_RESULT_MAX);
382 if (cache_result >= 0)
383 continue;
387 * Can't parse this as a cache op or result, so back up
388 * to the '-'.
390 --s;
391 break;
395 * Fall back to reads:
397 if (cache_op == -1)
398 cache_op = PERF_COUNT_HW_CACHE_OP_READ;
401 * Fall back to accesses:
403 if (cache_result == -1)
404 cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS;
406 attr->config = cache_type | (cache_op << 8) | (cache_result << 16);
407 attr->type = PERF_TYPE_HW_CACHE;
409 *str = s;
410 return EVT_HANDLED;
413 static enum event_result
414 parse_single_tracepoint_event(char *sys_name,
415 const char *evt_name,
416 unsigned int evt_length,
417 char *flags,
418 struct perf_event_attr *attr,
419 const char **strp)
421 char evt_path[MAXPATHLEN];
422 char id_buf[4];
423 u64 id;
424 int fd;
426 if (flags) {
427 if (!strncmp(flags, "record", strlen(flags))) {
428 attr->sample_type |= PERF_SAMPLE_RAW;
429 attr->sample_type |= PERF_SAMPLE_TIME;
430 attr->sample_type |= PERF_SAMPLE_CPU;
434 snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
435 sys_name, evt_name);
437 fd = open(evt_path, O_RDONLY);
438 if (fd < 0)
439 return EVT_FAILED;
441 if (read(fd, id_buf, sizeof(id_buf)) < 0) {
442 close(fd);
443 return EVT_FAILED;
446 close(fd);
447 id = atoll(id_buf);
448 attr->config = id;
449 attr->type = PERF_TYPE_TRACEPOINT;
450 *strp = evt_name + evt_length;
452 return EVT_HANDLED;
455 /* sys + ':' + event + ':' + flags*/
456 #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128)
457 static enum event_result
458 parse_subsystem_tracepoint_event(char *sys_name, char *flags)
460 char evt_path[MAXPATHLEN];
461 struct dirent *evt_ent;
462 DIR *evt_dir;
464 snprintf(evt_path, MAXPATHLEN, "%s/%s", debugfs_path, sys_name);
465 evt_dir = opendir(evt_path);
467 if (!evt_dir) {
468 perror("Can't open event dir");
469 return EVT_FAILED;
472 while ((evt_ent = readdir(evt_dir))) {
473 char event_opt[MAX_EVOPT_LEN + 1];
474 int len;
475 unsigned int rem = MAX_EVOPT_LEN;
477 if (!strcmp(evt_ent->d_name, ".")
478 || !strcmp(evt_ent->d_name, "..")
479 || !strcmp(evt_ent->d_name, "enable")
480 || !strcmp(evt_ent->d_name, "filter"))
481 continue;
483 len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s", sys_name,
484 evt_ent->d_name);
485 if (len < 0)
486 return EVT_FAILED;
488 rem -= len;
489 if (flags) {
490 if (rem < strlen(flags) + 1)
491 return EVT_FAILED;
493 strcat(event_opt, ":");
494 strcat(event_opt, flags);
497 if (parse_events(NULL, event_opt, 0))
498 return EVT_FAILED;
501 return EVT_HANDLED_ALL;
505 static enum event_result parse_tracepoint_event(const char **strp,
506 struct perf_event_attr *attr)
508 const char *evt_name;
509 char *flags;
510 char sys_name[MAX_EVENT_LENGTH];
511 unsigned int sys_length, evt_length;
513 if (valid_debugfs_mount(debugfs_path))
514 return 0;
516 evt_name = strchr(*strp, ':');
517 if (!evt_name)
518 return EVT_FAILED;
520 sys_length = evt_name - *strp;
521 if (sys_length >= MAX_EVENT_LENGTH)
522 return 0;
524 strncpy(sys_name, *strp, sys_length);
525 sys_name[sys_length] = '\0';
526 evt_name = evt_name + 1;
528 flags = strchr(evt_name, ':');
529 if (flags) {
530 /* split it out: */
531 evt_name = strndup(evt_name, flags - evt_name);
532 flags++;
535 evt_length = strlen(evt_name);
536 if (evt_length >= MAX_EVENT_LENGTH)
537 return EVT_FAILED;
539 if (!strcmp(evt_name, "*")) {
540 *strp = evt_name + evt_length;
541 return parse_subsystem_tracepoint_event(sys_name, flags);
542 } else
543 return parse_single_tracepoint_event(sys_name, evt_name,
544 evt_length, flags,
545 attr, strp);
548 static int check_events(const char *str, unsigned int i)
550 int n;
552 n = strlen(event_symbols[i].symbol);
553 if (!strncmp(str, event_symbols[i].symbol, n))
554 return n;
556 n = strlen(event_symbols[i].alias);
557 if (n)
558 if (!strncmp(str, event_symbols[i].alias, n))
559 return n;
560 return 0;
563 static enum event_result
564 parse_symbolic_event(const char **strp, struct perf_event_attr *attr)
566 const char *str = *strp;
567 unsigned int i;
568 int n;
570 for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
571 n = check_events(str, i);
572 if (n > 0) {
573 attr->type = event_symbols[i].type;
574 attr->config = event_symbols[i].config;
575 *strp = str + n;
576 return EVT_HANDLED;
579 return EVT_FAILED;
582 static enum event_result
583 parse_raw_event(const char **strp, struct perf_event_attr *attr)
585 const char *str = *strp;
586 u64 config;
587 int n;
589 if (*str != 'r')
590 return EVT_FAILED;
591 n = hex2u64(str + 1, &config);
592 if (n > 0) {
593 *strp = str + n + 1;
594 attr->type = PERF_TYPE_RAW;
595 attr->config = config;
596 return EVT_HANDLED;
598 return EVT_FAILED;
601 static enum event_result
602 parse_numeric_event(const char **strp, struct perf_event_attr *attr)
604 const char *str = *strp;
605 char *endp;
606 unsigned long type;
607 u64 config;
609 type = strtoul(str, &endp, 0);
610 if (endp > str && type < PERF_TYPE_MAX && *endp == ':') {
611 str = endp + 1;
612 config = strtoul(str, &endp, 0);
613 if (endp > str) {
614 attr->type = type;
615 attr->config = config;
616 *strp = endp;
617 return EVT_HANDLED;
620 return EVT_FAILED;
623 static enum event_result
624 parse_event_modifier(const char **strp, struct perf_event_attr *attr)
626 const char *str = *strp;
627 int eu = 1, ek = 1, eh = 1;
629 if (*str++ != ':')
630 return 0;
631 while (*str) {
632 if (*str == 'u')
633 eu = 0;
634 else if (*str == 'k')
635 ek = 0;
636 else if (*str == 'h')
637 eh = 0;
638 else
639 break;
640 ++str;
642 if (str >= *strp + 2) {
643 *strp = str;
644 attr->exclude_user = eu;
645 attr->exclude_kernel = ek;
646 attr->exclude_hv = eh;
647 return 1;
649 return 0;
653 * Each event can have multiple symbolic names.
654 * Symbolic names are (almost) exactly matched.
656 static enum event_result
657 parse_event_symbols(const char **str, struct perf_event_attr *attr)
659 enum event_result ret;
661 ret = parse_tracepoint_event(str, attr);
662 if (ret != EVT_FAILED)
663 goto modifier;
665 ret = parse_raw_event(str, attr);
666 if (ret != EVT_FAILED)
667 goto modifier;
669 ret = parse_numeric_event(str, attr);
670 if (ret != EVT_FAILED)
671 goto modifier;
673 ret = parse_symbolic_event(str, attr);
674 if (ret != EVT_FAILED)
675 goto modifier;
677 ret = parse_generic_hw_event(str, attr);
678 if (ret != EVT_FAILED)
679 goto modifier;
681 return EVT_FAILED;
683 modifier:
684 parse_event_modifier(str, attr);
686 return ret;
689 static void store_event_type(const char *orgname)
691 char filename[PATH_MAX], *c;
692 FILE *file;
693 int id;
695 sprintf(filename, "%s/", debugfs_path);
696 strncat(filename, orgname, strlen(orgname));
697 strcat(filename, "/id");
699 c = strchr(filename, ':');
700 if (c)
701 *c = '/';
703 file = fopen(filename, "r");
704 if (!file)
705 return;
706 if (fscanf(file, "%i", &id) < 1)
707 die("cannot store event ID");
708 fclose(file);
709 perf_header__push_event(id, orgname);
712 int parse_events(const struct option *opt __used, const char *str, int unset __used)
714 struct perf_event_attr attr;
715 enum event_result ret;
717 if (strchr(str, ':'))
718 store_event_type(str);
720 for (;;) {
721 if (nr_counters == MAX_COUNTERS)
722 return -1;
724 memset(&attr, 0, sizeof(attr));
725 ret = parse_event_symbols(&str, &attr);
726 if (ret == EVT_FAILED)
727 return -1;
729 if (!(*str == 0 || *str == ',' || isspace(*str)))
730 return -1;
732 if (ret != EVT_HANDLED_ALL) {
733 attrs[nr_counters] = attr;
734 nr_counters++;
737 if (*str == 0)
738 break;
739 if (*str == ',')
740 ++str;
741 while (isspace(*str))
742 ++str;
745 return 0;
748 int parse_filter(const struct option *opt __used, const char *str,
749 int unset __used)
751 int i = nr_counters - 1;
752 int len = strlen(str);
754 if (i < 0 || attrs[i].type != PERF_TYPE_TRACEPOINT) {
755 fprintf(stderr,
756 "-F option should follow a -e tracepoint option\n");
757 return -1;
760 filters[i] = malloc(len + 1);
761 if (!filters[i]) {
762 fprintf(stderr, "not enough memory to hold filter string\n");
763 return -1;
765 strcpy(filters[i], str);
767 return 0;
770 static const char * const event_type_descriptors[] = {
772 "Hardware event",
773 "Software event",
774 "Tracepoint event",
775 "Hardware cache event",
779 * Print the events from <debugfs_mount_point>/tracing/events
782 static void print_tracepoint_events(void)
784 DIR *sys_dir, *evt_dir;
785 struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
786 char evt_path[MAXPATHLEN];
787 char dir_path[MAXPATHLEN];
789 if (valid_debugfs_mount(debugfs_path))
790 return;
792 sys_dir = opendir(debugfs_path);
793 if (!sys_dir)
794 return;
796 for_each_subsystem(sys_dir, sys_dirent, sys_next) {
798 snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,
799 sys_dirent.d_name);
800 evt_dir = opendir(dir_path);
801 if (!evt_dir)
802 continue;
804 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
805 snprintf(evt_path, MAXPATHLEN, "%s:%s",
806 sys_dirent.d_name, evt_dirent.d_name);
807 fprintf(stderr, " %-42s [%s]\n", evt_path,
808 event_type_descriptors[PERF_TYPE_TRACEPOINT+1]);
810 closedir(evt_dir);
812 closedir(sys_dir);
816 * Print the help text for the event symbols:
818 void print_events(void)
820 struct event_symbol *syms = event_symbols;
821 unsigned int i, type, op, prev_type = -1;
822 char name[40];
824 fprintf(stderr, "\n");
825 fprintf(stderr, "List of pre-defined events (to be used in -e):\n");
827 for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
828 type = syms->type + 1;
829 if (type >= ARRAY_SIZE(event_type_descriptors))
830 type = 0;
832 if (type != prev_type)
833 fprintf(stderr, "\n");
835 if (strlen(syms->alias))
836 sprintf(name, "%s OR %s", syms->symbol, syms->alias);
837 else
838 strcpy(name, syms->symbol);
839 fprintf(stderr, " %-42s [%s]\n", name,
840 event_type_descriptors[type]);
842 prev_type = type;
845 fprintf(stderr, "\n");
846 for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
847 for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
848 /* skip invalid cache type */
849 if (!is_cache_op_valid(type, op))
850 continue;
852 for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
853 fprintf(stderr, " %-42s [%s]\n",
854 event_cache_name(type, op, i),
855 event_type_descriptors[4]);
860 fprintf(stderr, "\n");
861 fprintf(stderr, " %-42s [raw hardware event descriptor]\n",
862 "rNNN");
863 fprintf(stderr, "\n");
865 print_tracepoint_events();
867 exit(129);