parse-events.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. #include "util.h"
  2. #include "../perf.h"
  3. #include "parse-options.h"
  4. #include "parse-events.h"
  5. #include "exec_cmd.h"
  6. #include "string.h"
  7. #include "cache.h"
  8. int nr_counters;
  9. struct perf_counter_attr attrs[MAX_COUNTERS];
  10. struct event_symbol {
  11. u8 type;
  12. u64 config;
  13. const char *symbol;
  14. const char *alias;
  15. };
  16. char debugfs_path[MAXPATHLEN];
  17. #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
  18. #define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
  19. static struct event_symbol event_symbols[] = {
  20. { CHW(CPU_CYCLES), "cpu-cycles", "cycles" },
  21. { CHW(INSTRUCTIONS), "instructions", "" },
  22. { CHW(CACHE_REFERENCES), "cache-references", "" },
  23. { CHW(CACHE_MISSES), "cache-misses", "" },
  24. { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" },
  25. { CHW(BRANCH_MISSES), "branch-misses", "" },
  26. { CHW(BUS_CYCLES), "bus-cycles", "" },
  27. { CSW(CPU_CLOCK), "cpu-clock", "" },
  28. { CSW(TASK_CLOCK), "task-clock", "" },
  29. { CSW(PAGE_FAULTS), "page-faults", "faults" },
  30. { CSW(PAGE_FAULTS_MIN), "minor-faults", "" },
  31. { CSW(PAGE_FAULTS_MAJ), "major-faults", "" },
  32. { CSW(CONTEXT_SWITCHES), "context-switches", "cs" },
  33. { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" },
  34. };
  35. #define __PERF_COUNTER_FIELD(config, name) \
  36. ((config & PERF_COUNTER_##name##_MASK) >> PERF_COUNTER_##name##_SHIFT)
  37. #define PERF_COUNTER_RAW(config) __PERF_COUNTER_FIELD(config, RAW)
  38. #define PERF_COUNTER_CONFIG(config) __PERF_COUNTER_FIELD(config, CONFIG)
  39. #define PERF_COUNTER_TYPE(config) __PERF_COUNTER_FIELD(config, TYPE)
  40. #define PERF_COUNTER_ID(config) __PERF_COUNTER_FIELD(config, EVENT)
  41. static const char *hw_event_names[] = {
  42. "cycles",
  43. "instructions",
  44. "cache-references",
  45. "cache-misses",
  46. "branches",
  47. "branch-misses",
  48. "bus-cycles",
  49. };
  50. static const char *sw_event_names[] = {
  51. "cpu-clock-msecs",
  52. "task-clock-msecs",
  53. "page-faults",
  54. "context-switches",
  55. "CPU-migrations",
  56. "minor-faults",
  57. "major-faults",
  58. };
  59. #define MAX_ALIASES 8
  60. static const char *hw_cache[][MAX_ALIASES] = {
  61. { "L1-dcache", "l1-d", "l1d", "L1-data", },
  62. { "L1-icache", "l1-i", "l1i", "L1-instruction", },
  63. { "LLC", "L2" },
  64. { "dTLB", "d-tlb", "Data-TLB", },
  65. { "iTLB", "i-tlb", "Instruction-TLB", },
  66. { "branch", "branches", "bpu", "btb", "bpc", },
  67. };
  68. static const char *hw_cache_op[][MAX_ALIASES] = {
  69. { "load", "loads", "read", },
  70. { "store", "stores", "write", },
  71. { "prefetch", "prefetches", "speculative-read", "speculative-load", },
  72. };
  73. static const char *hw_cache_result[][MAX_ALIASES] = {
  74. { "refs", "Reference", "ops", "access", },
  75. { "misses", "miss", },
  76. };
  77. #define C(x) PERF_COUNT_HW_CACHE_##x
  78. #define CACHE_READ (1 << C(OP_READ))
  79. #define CACHE_WRITE (1 << C(OP_WRITE))
  80. #define CACHE_PREFETCH (1 << C(OP_PREFETCH))
  81. #define COP(x) (1 << x)
  82. /*
  83. * cache operartion stat
  84. * L1I : Read and prefetch only
  85. * ITLB and BPU : Read-only
  86. */
  87. static unsigned long hw_cache_stat[C(MAX)] = {
  88. [C(L1D)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
  89. [C(L1I)] = (CACHE_READ | CACHE_PREFETCH),
  90. [C(LL)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
  91. [C(DTLB)] = (CACHE_READ | CACHE_WRITE | CACHE_PREFETCH),
  92. [C(ITLB)] = (CACHE_READ),
  93. [C(BPU)] = (CACHE_READ),
  94. };
  95. #define for_each_subsystem(sys_dir, sys_dirent, sys_next) \
  96. while (!readdir_r(sys_dir, &sys_dirent, &sys_next) && sys_next) \
  97. if (sys_dirent.d_type == DT_DIR && \
  98. (strcmp(sys_dirent.d_name, ".")) && \
  99. (strcmp(sys_dirent.d_name, "..")))
  100. static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
  101. {
  102. char evt_path[MAXPATHLEN];
  103. int fd;
  104. snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
  105. sys_dir->d_name, evt_dir->d_name);
  106. fd = open(evt_path, O_RDONLY);
  107. if (fd < 0)
  108. return -EINVAL;
  109. close(fd);
  110. return 0;
  111. }
  112. #define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) \
  113. while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next) \
  114. if (evt_dirent.d_type == DT_DIR && \
  115. (strcmp(evt_dirent.d_name, ".")) && \
  116. (strcmp(evt_dirent.d_name, "..")) && \
  117. (!tp_event_has_id(&sys_dirent, &evt_dirent)))
  118. #define MAX_EVENT_LENGTH 30
  119. int valid_debugfs_mount(const char *debugfs)
  120. {
  121. struct statfs st_fs;
  122. if (statfs(debugfs, &st_fs) < 0)
  123. return -ENOENT;
  124. else if (st_fs.f_type != (long) DEBUGFS_MAGIC)
  125. return -ENOENT;
  126. return 0;
  127. }
  128. struct tracepoint_path *tracepoint_id_to_path(u64 config)
  129. {
  130. struct tracepoint_path *path = NULL;
  131. DIR *sys_dir, *evt_dir;
  132. struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
  133. char id_buf[4];
  134. int sys_dir_fd, fd;
  135. u64 id;
  136. char evt_path[MAXPATHLEN];
  137. if (valid_debugfs_mount(debugfs_path))
  138. return NULL;
  139. sys_dir = opendir(debugfs_path);
  140. if (!sys_dir)
  141. goto cleanup;
  142. sys_dir_fd = dirfd(sys_dir);
  143. for_each_subsystem(sys_dir, sys_dirent, sys_next) {
  144. int dfd = openat(sys_dir_fd, sys_dirent.d_name,
  145. O_RDONLY|O_DIRECTORY), evt_dir_fd;
  146. if (dfd == -1)
  147. continue;
  148. evt_dir = fdopendir(dfd);
  149. if (!evt_dir) {
  150. close(dfd);
  151. continue;
  152. }
  153. evt_dir_fd = dirfd(evt_dir);
  154. for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
  155. snprintf(evt_path, MAXPATHLEN, "%s/id",
  156. evt_dirent.d_name);
  157. fd = openat(evt_dir_fd, evt_path, O_RDONLY);
  158. if (fd < 0)
  159. continue;
  160. if (read(fd, id_buf, sizeof(id_buf)) < 0) {
  161. close(fd);
  162. continue;
  163. }
  164. close(fd);
  165. id = atoll(id_buf);
  166. if (id == config) {
  167. closedir(evt_dir);
  168. closedir(sys_dir);
  169. path = calloc(1, sizeof(path));
  170. path->system = malloc(MAX_EVENT_LENGTH);
  171. if (!path->system) {
  172. free(path);
  173. return NULL;
  174. }
  175. path->name = malloc(MAX_EVENT_LENGTH);
  176. if (!path->name) {
  177. free(path->system);
  178. free(path);
  179. return NULL;
  180. }
  181. strncpy(path->system, sys_dirent.d_name,
  182. MAX_EVENT_LENGTH);
  183. strncpy(path->name, evt_dirent.d_name,
  184. MAX_EVENT_LENGTH);
  185. return path;
  186. }
  187. }
  188. closedir(evt_dir);
  189. }
  190. cleanup:
  191. closedir(sys_dir);
  192. return NULL;
  193. }
  194. #define TP_PATH_LEN (MAX_EVENT_LENGTH * 2 + 1)
  195. static const char *tracepoint_id_to_name(u64 config)
  196. {
  197. static char buf[TP_PATH_LEN];
  198. struct tracepoint_path *path;
  199. path = tracepoint_id_to_path(config);
  200. if (path) {
  201. snprintf(buf, TP_PATH_LEN, "%s:%s", path->system, path->name);
  202. free(path->name);
  203. free(path->system);
  204. free(path);
  205. } else
  206. snprintf(buf, TP_PATH_LEN, "%s:%s", "unknown", "unknown");
  207. return buf;
  208. }
  209. static int is_cache_op_valid(u8 cache_type, u8 cache_op)
  210. {
  211. if (hw_cache_stat[cache_type] & COP(cache_op))
  212. return 1; /* valid */
  213. else
  214. return 0; /* invalid */
  215. }
  216. static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result)
  217. {
  218. static char name[50];
  219. if (cache_result) {
  220. sprintf(name, "%s-%s-%s", hw_cache[cache_type][0],
  221. hw_cache_op[cache_op][0],
  222. hw_cache_result[cache_result][0]);
  223. } else {
  224. sprintf(name, "%s-%s", hw_cache[cache_type][0],
  225. hw_cache_op[cache_op][1]);
  226. }
  227. return name;
  228. }
  229. const char *event_name(int counter)
  230. {
  231. u64 config = attrs[counter].config;
  232. int type = attrs[counter].type;
  233. return __event_name(type, config);
  234. }
  235. const char *__event_name(int type, u64 config)
  236. {
  237. static char buf[32];
  238. if (type == PERF_TYPE_RAW) {
  239. sprintf(buf, "raw 0x%llx", config);
  240. return buf;
  241. }
  242. switch (type) {
  243. case PERF_TYPE_HARDWARE:
  244. if (config < PERF_COUNT_HW_MAX)
  245. return hw_event_names[config];
  246. return "unknown-hardware";
  247. case PERF_TYPE_HW_CACHE: {
  248. u8 cache_type, cache_op, cache_result;
  249. cache_type = (config >> 0) & 0xff;
  250. if (cache_type > PERF_COUNT_HW_CACHE_MAX)
  251. return "unknown-ext-hardware-cache-type";
  252. cache_op = (config >> 8) & 0xff;
  253. if (cache_op > PERF_COUNT_HW_CACHE_OP_MAX)
  254. return "unknown-ext-hardware-cache-op";
  255. cache_result = (config >> 16) & 0xff;
  256. if (cache_result > PERF_COUNT_HW_CACHE_RESULT_MAX)
  257. return "unknown-ext-hardware-cache-result";
  258. if (!is_cache_op_valid(cache_type, cache_op))
  259. return "invalid-cache";
  260. return event_cache_name(cache_type, cache_op, cache_result);
  261. }
  262. case PERF_TYPE_SOFTWARE:
  263. if (config < PERF_COUNT_SW_MAX)
  264. return sw_event_names[config];
  265. return "unknown-software";
  266. case PERF_TYPE_TRACEPOINT:
  267. return tracepoint_id_to_name(config);
  268. default:
  269. break;
  270. }
  271. return "unknown";
  272. }
  273. static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size)
  274. {
  275. int i, j;
  276. int n, longest = -1;
  277. for (i = 0; i < size; i++) {
  278. for (j = 0; j < MAX_ALIASES && names[i][j]; j++) {
  279. n = strlen(names[i][j]);
  280. if (n > longest && !strncasecmp(*str, names[i][j], n))
  281. longest = n;
  282. }
  283. if (longest > 0) {
  284. *str += longest;
  285. return i;
  286. }
  287. }
  288. return -1;
  289. }
  290. static int
  291. parse_generic_hw_event(const char **str, struct perf_counter_attr *attr)
  292. {
  293. const char *s = *str;
  294. int cache_type = -1, cache_op = -1, cache_result = -1;
  295. cache_type = parse_aliases(&s, hw_cache, PERF_COUNT_HW_CACHE_MAX);
  296. /*
  297. * No fallback - if we cannot get a clear cache type
  298. * then bail out:
  299. */
  300. if (cache_type == -1)
  301. return 0;
  302. while ((cache_op == -1 || cache_result == -1) && *s == '-') {
  303. ++s;
  304. if (cache_op == -1) {
  305. cache_op = parse_aliases(&s, hw_cache_op,
  306. PERF_COUNT_HW_CACHE_OP_MAX);
  307. if (cache_op >= 0) {
  308. if (!is_cache_op_valid(cache_type, cache_op))
  309. return 0;
  310. continue;
  311. }
  312. }
  313. if (cache_result == -1) {
  314. cache_result = parse_aliases(&s, hw_cache_result,
  315. PERF_COUNT_HW_CACHE_RESULT_MAX);
  316. if (cache_result >= 0)
  317. continue;
  318. }
  319. /*
  320. * Can't parse this as a cache op or result, so back up
  321. * to the '-'.
  322. */
  323. --s;
  324. break;
  325. }
  326. /*
  327. * Fall back to reads:
  328. */
  329. if (cache_op == -1)
  330. cache_op = PERF_COUNT_HW_CACHE_OP_READ;
  331. /*
  332. * Fall back to accesses:
  333. */
  334. if (cache_result == -1)
  335. cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS;
  336. attr->config = cache_type | (cache_op << 8) | (cache_result << 16);
  337. attr->type = PERF_TYPE_HW_CACHE;
  338. *str = s;
  339. return 1;
  340. }
  341. static int parse_tracepoint_event(const char **strp,
  342. struct perf_counter_attr *attr)
  343. {
  344. const char *evt_name;
  345. char *flags;
  346. char sys_name[MAX_EVENT_LENGTH];
  347. char id_buf[4];
  348. int fd;
  349. unsigned int sys_length, evt_length;
  350. u64 id;
  351. char evt_path[MAXPATHLEN];
  352. if (valid_debugfs_mount(debugfs_path))
  353. return 0;
  354. evt_name = strchr(*strp, ':');
  355. if (!evt_name)
  356. return 0;
  357. sys_length = evt_name - *strp;
  358. if (sys_length >= MAX_EVENT_LENGTH)
  359. return 0;
  360. strncpy(sys_name, *strp, sys_length);
  361. sys_name[sys_length] = '\0';
  362. evt_name = evt_name + 1;
  363. flags = strchr(evt_name, ':');
  364. if (flags) {
  365. *flags = '\0';
  366. flags++;
  367. if (!strncmp(flags, "record", strlen(flags)))
  368. attr->sample_type |= PERF_SAMPLE_RAW;
  369. }
  370. evt_length = strlen(evt_name);
  371. if (evt_length >= MAX_EVENT_LENGTH)
  372. return 0;
  373. snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,
  374. sys_name, evt_name);
  375. fd = open(evt_path, O_RDONLY);
  376. if (fd < 0)
  377. return 0;
  378. if (read(fd, id_buf, sizeof(id_buf)) < 0) {
  379. close(fd);
  380. return 0;
  381. }
  382. close(fd);
  383. id = atoll(id_buf);
  384. attr->config = id;
  385. attr->type = PERF_TYPE_TRACEPOINT;
  386. *strp = evt_name + evt_length;
  387. return 1;
  388. }
  389. static int check_events(const char *str, unsigned int i)
  390. {
  391. int n;
  392. n = strlen(event_symbols[i].symbol);
  393. if (!strncmp(str, event_symbols[i].symbol, n))
  394. return n;
  395. n = strlen(event_symbols[i].alias);
  396. if (n)
  397. if (!strncmp(str, event_symbols[i].alias, n))
  398. return n;
  399. return 0;
  400. }
  401. static int
  402. parse_symbolic_event(const char **strp, struct perf_counter_attr *attr)
  403. {
  404. const char *str = *strp;
  405. unsigned int i;
  406. int n;
  407. for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
  408. n = check_events(str, i);
  409. if (n > 0) {
  410. attr->type = event_symbols[i].type;
  411. attr->config = event_symbols[i].config;
  412. *strp = str + n;
  413. return 1;
  414. }
  415. }
  416. return 0;
  417. }
  418. static int parse_raw_event(const char **strp, struct perf_counter_attr *attr)
  419. {
  420. const char *str = *strp;
  421. u64 config;
  422. int n;
  423. if (*str != 'r')
  424. return 0;
  425. n = hex2u64(str + 1, &config);
  426. if (n > 0) {
  427. *strp = str + n + 1;
  428. attr->type = PERF_TYPE_RAW;
  429. attr->config = config;
  430. return 1;
  431. }
  432. return 0;
  433. }
  434. static int
  435. parse_numeric_event(const char **strp, struct perf_counter_attr *attr)
  436. {
  437. const char *str = *strp;
  438. char *endp;
  439. unsigned long type;
  440. u64 config;
  441. type = strtoul(str, &endp, 0);
  442. if (endp > str && type < PERF_TYPE_MAX && *endp == ':') {
  443. str = endp + 1;
  444. config = strtoul(str, &endp, 0);
  445. if (endp > str) {
  446. attr->type = type;
  447. attr->config = config;
  448. *strp = endp;
  449. return 1;
  450. }
  451. }
  452. return 0;
  453. }
  454. static int
  455. parse_event_modifier(const char **strp, struct perf_counter_attr *attr)
  456. {
  457. const char *str = *strp;
  458. int eu = 1, ek = 1, eh = 1;
  459. if (*str++ != ':')
  460. return 0;
  461. while (*str) {
  462. if (*str == 'u')
  463. eu = 0;
  464. else if (*str == 'k')
  465. ek = 0;
  466. else if (*str == 'h')
  467. eh = 0;
  468. else
  469. break;
  470. ++str;
  471. }
  472. if (str >= *strp + 2) {
  473. *strp = str;
  474. attr->exclude_user = eu;
  475. attr->exclude_kernel = ek;
  476. attr->exclude_hv = eh;
  477. return 1;
  478. }
  479. return 0;
  480. }
  481. /*
  482. * Each event can have multiple symbolic names.
  483. * Symbolic names are (almost) exactly matched.
  484. */
  485. static int parse_event_symbols(const char **str, struct perf_counter_attr *attr)
  486. {
  487. if (!(parse_tracepoint_event(str, attr) ||
  488. parse_raw_event(str, attr) ||
  489. parse_numeric_event(str, attr) ||
  490. parse_symbolic_event(str, attr) ||
  491. parse_generic_hw_event(str, attr)))
  492. return 0;
  493. parse_event_modifier(str, attr);
  494. return 1;
  495. }
  496. int parse_events(const struct option *opt __used, const char *str, int unset __used)
  497. {
  498. struct perf_counter_attr attr;
  499. for (;;) {
  500. if (nr_counters == MAX_COUNTERS)
  501. return -1;
  502. memset(&attr, 0, sizeof(attr));
  503. if (!parse_event_symbols(&str, &attr))
  504. return -1;
  505. if (!(*str == 0 || *str == ',' || isspace(*str)))
  506. return -1;
  507. attrs[nr_counters] = attr;
  508. nr_counters++;
  509. if (*str == 0)
  510. break;
  511. if (*str == ',')
  512. ++str;
  513. while (isspace(*str))
  514. ++str;
  515. }
  516. return 0;
  517. }
  518. static const char * const event_type_descriptors[] = {
  519. "",
  520. "Hardware event",
  521. "Software event",
  522. "Tracepoint event",
  523. "Hardware cache event",
  524. };
  525. /*
  526. * Print the events from <debugfs_mount_point>/tracing/events
  527. */
  528. static void print_tracepoint_events(void)
  529. {
  530. DIR *sys_dir, *evt_dir;
  531. struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
  532. int sys_dir_fd;
  533. char evt_path[MAXPATHLEN];
  534. if (valid_debugfs_mount(debugfs_path))
  535. return;
  536. sys_dir = opendir(debugfs_path);
  537. if (!sys_dir)
  538. goto cleanup;
  539. sys_dir_fd = dirfd(sys_dir);
  540. for_each_subsystem(sys_dir, sys_dirent, sys_next) {
  541. int dfd = openat(sys_dir_fd, sys_dirent.d_name,
  542. O_RDONLY|O_DIRECTORY), evt_dir_fd;
  543. if (dfd == -1)
  544. continue;
  545. evt_dir = fdopendir(dfd);
  546. if (!evt_dir) {
  547. close(dfd);
  548. continue;
  549. }
  550. evt_dir_fd = dirfd(evt_dir);
  551. for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
  552. snprintf(evt_path, MAXPATHLEN, "%s:%s",
  553. sys_dirent.d_name, evt_dirent.d_name);
  554. fprintf(stderr, " %-42s [%s]\n", evt_path,
  555. event_type_descriptors[PERF_TYPE_TRACEPOINT+1]);
  556. }
  557. closedir(evt_dir);
  558. }
  559. cleanup:
  560. closedir(sys_dir);
  561. }
  562. /*
  563. * Print the help text for the event symbols:
  564. */
  565. void print_events(void)
  566. {
  567. struct event_symbol *syms = event_symbols;
  568. unsigned int i, type, op, prev_type = -1;
  569. char name[40];
  570. fprintf(stderr, "\n");
  571. fprintf(stderr, "List of pre-defined events (to be used in -e):\n");
  572. for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
  573. type = syms->type + 1;
  574. if (type >= ARRAY_SIZE(event_type_descriptors))
  575. type = 0;
  576. if (type != prev_type)
  577. fprintf(stderr, "\n");
  578. if (strlen(syms->alias))
  579. sprintf(name, "%s OR %s", syms->symbol, syms->alias);
  580. else
  581. strcpy(name, syms->symbol);
  582. fprintf(stderr, " %-42s [%s]\n", name,
  583. event_type_descriptors[type]);
  584. prev_type = type;
  585. }
  586. fprintf(stderr, "\n");
  587. for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
  588. for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
  589. /* skip invalid cache type */
  590. if (!is_cache_op_valid(type, op))
  591. continue;
  592. for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
  593. fprintf(stderr, " %-42s [%s]\n",
  594. event_cache_name(type, op, i),
  595. event_type_descriptors[4]);
  596. }
  597. }
  598. }
  599. fprintf(stderr, "\n");
  600. fprintf(stderr, " %-42s [raw hardware event descriptor]\n",
  601. "rNNN");
  602. fprintf(stderr, "\n");
  603. print_tracepoint_events();
  604. exit(129);
  605. }