builtin-report.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. #include "util/util.h"
  2. #include "builtin.h"
  3. #include "util/list.h"
  4. #include "util/cache.h"
  5. #include "util/rbtree.h"
  6. #include "util/symbol.h"
  7. #include "perf.h"
  8. #include "util/parse-options.h"
  9. #include "util/parse-events.h"
  10. #define SHOW_KERNEL 1
  11. #define SHOW_USER 2
  12. #define SHOW_HV 4
  13. static char const *input_name = "perf.data";
  14. static char *vmlinux = NULL;
  15. static char *sort_order = "pid,symbol";
  16. static int input;
  17. static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
  18. static int dump_trace = 0;
  19. static int verbose;
  20. static unsigned long page_size;
  21. static unsigned long mmap_window = 32;
  22. const char *perf_event_names[] = {
  23. [PERF_EVENT_MMAP] = " PERF_EVENT_MMAP",
  24. [PERF_EVENT_MUNMAP] = " PERF_EVENT_MUNMAP",
  25. [PERF_EVENT_COMM] = " PERF_EVENT_COMM",
  26. };
  27. struct ip_event {
  28. struct perf_event_header header;
  29. __u64 ip;
  30. __u32 pid, tid;
  31. };
  32. struct mmap_event {
  33. struct perf_event_header header;
  34. __u32 pid, tid;
  35. __u64 start;
  36. __u64 len;
  37. __u64 pgoff;
  38. char filename[PATH_MAX];
  39. };
  40. struct comm_event {
  41. struct perf_event_header header;
  42. __u32 pid,tid;
  43. char comm[16];
  44. };
  45. typedef union event_union {
  46. struct perf_event_header header;
  47. struct ip_event ip;
  48. struct mmap_event mmap;
  49. struct comm_event comm;
  50. } event_t;
  51. static LIST_HEAD(dsos);
  52. static struct dso *kernel_dso;
  53. static void dsos__add(struct dso *dso)
  54. {
  55. list_add_tail(&dso->node, &dsos);
  56. }
  57. static struct dso *dsos__find(const char *name)
  58. {
  59. struct dso *pos;
  60. list_for_each_entry(pos, &dsos, node)
  61. if (strcmp(pos->name, name) == 0)
  62. return pos;
  63. return NULL;
  64. }
  65. static struct dso *dsos__findnew(const char *name)
  66. {
  67. struct dso *dso = dsos__find(name);
  68. int nr;
  69. if (dso == NULL) {
  70. dso = dso__new(name, 0);
  71. if (!dso)
  72. goto out_delete_dso;
  73. nr = dso__load(dso);
  74. if (nr < 0) {
  75. fprintf(stderr, "Failed to open: %s\n", name);
  76. goto out_delete_dso;
  77. }
  78. if (!nr) {
  79. fprintf(stderr,
  80. "Failed to find debug symbols for: %s, maybe install a debug package?\n",
  81. name);
  82. }
  83. dsos__add(dso);
  84. }
  85. return dso;
  86. out_delete_dso:
  87. dso__delete(dso);
  88. return NULL;
  89. }
  90. static void dsos__fprintf(FILE *fp)
  91. {
  92. struct dso *pos;
  93. list_for_each_entry(pos, &dsos, node)
  94. dso__fprintf(pos, fp);
  95. }
  96. static int load_kernel(void)
  97. {
  98. int err;
  99. kernel_dso = dso__new("[kernel]", 0);
  100. if (!kernel_dso)
  101. return -1;
  102. err = dso__load_kernel(kernel_dso, vmlinux);
  103. if (err) {
  104. dso__delete(kernel_dso);
  105. kernel_dso = NULL;
  106. } else
  107. dsos__add(kernel_dso);
  108. return err;
  109. }
  110. struct map {
  111. struct list_head node;
  112. uint64_t start;
  113. uint64_t end;
  114. uint64_t pgoff;
  115. struct dso *dso;
  116. };
  117. static struct map *map__new(struct mmap_event *event)
  118. {
  119. struct map *self = malloc(sizeof(*self));
  120. if (self != NULL) {
  121. self->start = event->start;
  122. self->end = event->start + event->len;
  123. self->pgoff = event->pgoff;
  124. self->dso = dsos__findnew(event->filename);
  125. if (self->dso == NULL)
  126. goto out_delete;
  127. }
  128. return self;
  129. out_delete:
  130. free(self);
  131. return NULL;
  132. }
  133. struct thread;
  134. struct thread {
  135. struct rb_node rb_node;
  136. struct list_head maps;
  137. pid_t pid;
  138. char *comm;
  139. };
  140. static struct thread *thread__new(pid_t pid)
  141. {
  142. struct thread *self = malloc(sizeof(*self));
  143. if (self != NULL) {
  144. self->pid = pid;
  145. self->comm = NULL;
  146. INIT_LIST_HEAD(&self->maps);
  147. }
  148. return self;
  149. }
  150. static int thread__set_comm(struct thread *self, const char *comm)
  151. {
  152. self->comm = strdup(comm);
  153. return self->comm ? 0 : -ENOMEM;
  154. }
  155. static struct rb_root threads;
  156. static struct thread *threads__findnew(pid_t pid)
  157. {
  158. struct rb_node **p = &threads.rb_node;
  159. struct rb_node *parent = NULL;
  160. struct thread *th;
  161. while (*p != NULL) {
  162. parent = *p;
  163. th = rb_entry(parent, struct thread, rb_node);
  164. if (th->pid == pid)
  165. return th;
  166. if (pid < th->pid)
  167. p = &(*p)->rb_left;
  168. else
  169. p = &(*p)->rb_right;
  170. }
  171. th = thread__new(pid);
  172. if (th != NULL) {
  173. rb_link_node(&th->rb_node, parent, p);
  174. rb_insert_color(&th->rb_node, &threads);
  175. }
  176. return th;
  177. }
  178. static void thread__insert_map(struct thread *self, struct map *map)
  179. {
  180. list_add_tail(&map->node, &self->maps);
  181. }
  182. static struct map *thread__find_map(struct thread *self, uint64_t ip)
  183. {
  184. struct map *pos;
  185. if (self == NULL)
  186. return NULL;
  187. list_for_each_entry(pos, &self->maps, node)
  188. if (ip >= pos->start && ip <= pos->end)
  189. return pos;
  190. return NULL;
  191. }
  192. /*
  193. * histogram, sorted on item, collects counts
  194. */
  195. static struct rb_root hist;
  196. struct hist_entry {
  197. struct rb_node rb_node;
  198. struct thread *thread;
  199. struct map *map;
  200. struct dso *dso;
  201. struct symbol *sym;
  202. uint64_t ip;
  203. char level;
  204. uint32_t count;
  205. };
  206. /*
  207. * configurable sorting bits
  208. */
  209. struct sort_entry {
  210. struct list_head list;
  211. char *header;
  212. int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
  213. size_t (*print)(FILE *fp, struct hist_entry *);
  214. };
  215. static int64_t
  216. sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
  217. {
  218. return right->thread->pid - left->thread->pid;
  219. }
  220. static size_t
  221. sort__thread_print(FILE *fp, struct hist_entry *self)
  222. {
  223. return fprintf(fp, " %16s:%5d", self->thread->comm ?: "", self->thread->pid);
  224. }
  225. static struct sort_entry sort_thread = {
  226. .header = " Command: Pid ",
  227. .cmp = sort__thread_cmp,
  228. .print = sort__thread_print,
  229. };
  230. static int64_t
  231. sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
  232. {
  233. char *comm_l = left->thread->comm;
  234. char *comm_r = right->thread->comm;
  235. if (!comm_l || !comm_r) {
  236. if (!comm_l && !comm_r)
  237. return 0;
  238. else if (!comm_l)
  239. return -1;
  240. else
  241. return 1;
  242. }
  243. return strcmp(comm_l, comm_r);
  244. }
  245. static size_t
  246. sort__comm_print(FILE *fp, struct hist_entry *self)
  247. {
  248. return fprintf(fp, " %16s", self->thread->comm ?: "<unknown>");
  249. }
  250. static struct sort_entry sort_comm = {
  251. .header = " Command",
  252. .cmp = sort__comm_cmp,
  253. .print = sort__comm_print,
  254. };
  255. static int64_t
  256. sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
  257. {
  258. struct dso *dso_l = left->dso;
  259. struct dso *dso_r = right->dso;
  260. if (!dso_l || !dso_r) {
  261. if (!dso_l && !dso_r)
  262. return 0;
  263. else if (!dso_l)
  264. return -1;
  265. else
  266. return 1;
  267. }
  268. return strcmp(dso_l->name, dso_r->name);
  269. }
  270. static size_t
  271. sort__dso_print(FILE *fp, struct hist_entry *self)
  272. {
  273. return fprintf(fp, " %64s", self->dso ? self->dso->name : "<unknown>");
  274. }
  275. static struct sort_entry sort_dso = {
  276. .header = " Shared Object",
  277. .cmp = sort__dso_cmp,
  278. .print = sort__dso_print,
  279. };
  280. static int64_t
  281. sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
  282. {
  283. uint64_t ip_l, ip_r;
  284. if (left->sym == right->sym)
  285. return 0;
  286. ip_l = left->sym ? left->sym->start : left->ip;
  287. ip_r = right->sym ? right->sym->start : right->ip;
  288. return (int64_t)(ip_r - ip_l);
  289. }
  290. static size_t
  291. sort__sym_print(FILE *fp, struct hist_entry *self)
  292. {
  293. size_t ret = 0;
  294. if (verbose)
  295. ret += fprintf(fp, " %#018llx", (unsigned long long)self->ip);
  296. ret += fprintf(fp, " %s: %s",
  297. self->dso ? self->dso->name : "<unknown>",
  298. self->sym ? self->sym->name : "<unknown>");
  299. return ret;
  300. }
  301. static struct sort_entry sort_sym = {
  302. .header = "Shared Object: Symbol",
  303. .cmp = sort__sym_cmp,
  304. .print = sort__sym_print,
  305. };
  306. struct sort_dimension {
  307. char *name;
  308. struct sort_entry *entry;
  309. int taken;
  310. };
  311. static struct sort_dimension sort_dimensions[] = {
  312. { .name = "pid", .entry = &sort_thread, },
  313. { .name = "comm", .entry = &sort_comm, },
  314. { .name = "dso", .entry = &sort_dso, },
  315. { .name = "symbol", .entry = &sort_sym, },
  316. };
  317. static LIST_HEAD(hist_entry__sort_list);
  318. static int sort_dimension__add(char *tok)
  319. {
  320. int i;
  321. for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) {
  322. struct sort_dimension *sd = &sort_dimensions[i];
  323. if (sd->taken)
  324. continue;
  325. if (strcmp(tok, sd->name))
  326. continue;
  327. list_add_tail(&sd->entry->list, &hist_entry__sort_list);
  328. sd->taken = 1;
  329. return 0;
  330. }
  331. return -ESRCH;
  332. }
  333. static void setup_sorting(void)
  334. {
  335. char *tmp, *tok, *str = strdup(sort_order);
  336. for (tok = strtok_r(str, ", ", &tmp);
  337. tok; tok = strtok_r(NULL, ", ", &tmp))
  338. sort_dimension__add(tok);
  339. free(str);
  340. }
  341. static int64_t
  342. hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
  343. {
  344. struct sort_entry *se;
  345. int64_t cmp = 0;
  346. list_for_each_entry(se, &hist_entry__sort_list, list) {
  347. cmp = se->cmp(left, right);
  348. if (cmp)
  349. break;
  350. }
  351. return cmp;
  352. }
  353. static size_t
  354. hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
  355. {
  356. struct sort_entry *se;
  357. size_t ret;
  358. if (total_samples) {
  359. ret = fprintf(fp, " %5.2f%%",
  360. (self->count * 100.0) / total_samples);
  361. } else
  362. ret = fprintf(fp, "%12d ", self->count);
  363. list_for_each_entry(se, &hist_entry__sort_list, list)
  364. ret += se->print(fp, self);
  365. ret += fprintf(fp, "\n");
  366. return ret;
  367. }
  368. /*
  369. * collect histogram counts
  370. */
  371. static int
  372. hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
  373. struct symbol *sym, uint64_t ip, char level)
  374. {
  375. struct rb_node **p = &hist.rb_node;
  376. struct rb_node *parent = NULL;
  377. struct hist_entry *he;
  378. struct hist_entry entry = {
  379. .thread = thread,
  380. .map = map,
  381. .dso = dso,
  382. .sym = sym,
  383. .ip = ip,
  384. .level = level,
  385. .count = 1,
  386. };
  387. int cmp;
  388. while (*p != NULL) {
  389. parent = *p;
  390. he = rb_entry(parent, struct hist_entry, rb_node);
  391. cmp = hist_entry__cmp(&entry, he);
  392. if (!cmp) {
  393. he->count++;
  394. return 0;
  395. }
  396. if (cmp < 0)
  397. p = &(*p)->rb_left;
  398. else
  399. p = &(*p)->rb_right;
  400. }
  401. he = malloc(sizeof(*he));
  402. if (!he)
  403. return -ENOMEM;
  404. *he = entry;
  405. rb_link_node(&he->rb_node, parent, p);
  406. rb_insert_color(&he->rb_node, &hist);
  407. return 0;
  408. }
  409. /*
  410. * reverse the map, sort on count.
  411. */
  412. static struct rb_root output_hists;
  413. static void output__insert_entry(struct hist_entry *he)
  414. {
  415. struct rb_node **p = &output_hists.rb_node;
  416. struct rb_node *parent = NULL;
  417. struct hist_entry *iter;
  418. while (*p != NULL) {
  419. parent = *p;
  420. iter = rb_entry(parent, struct hist_entry, rb_node);
  421. if (he->count > iter->count)
  422. p = &(*p)->rb_left;
  423. else
  424. p = &(*p)->rb_right;
  425. }
  426. rb_link_node(&he->rb_node, parent, p);
  427. rb_insert_color(&he->rb_node, &output_hists);
  428. }
  429. static void output__resort(void)
  430. {
  431. struct rb_node *next = rb_first(&hist);
  432. struct hist_entry *n;
  433. while (next) {
  434. n = rb_entry(next, struct hist_entry, rb_node);
  435. next = rb_next(&n->rb_node);
  436. rb_erase(&n->rb_node, &hist);
  437. output__insert_entry(n);
  438. }
  439. }
  440. static size_t output__fprintf(FILE *fp, uint64_t total_samples)
  441. {
  442. struct hist_entry *pos;
  443. struct sort_entry *se;
  444. struct rb_node *nd;
  445. size_t ret = 0;
  446. fprintf(fp, "#\n");
  447. fprintf(fp, "# Overhead");
  448. list_for_each_entry(se, &hist_entry__sort_list, list)
  449. fprintf(fp, " %s", se->header);
  450. fprintf(fp, "\n");
  451. fprintf(fp, "# ........");
  452. list_for_each_entry(se, &hist_entry__sort_list, list) {
  453. int i;
  454. fprintf(fp, " ");
  455. for (i = 0; i < strlen(se->header); i++)
  456. fprintf(fp, ".");
  457. }
  458. fprintf(fp, "\n");
  459. fprintf(fp, "#\n");
  460. for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
  461. pos = rb_entry(nd, struct hist_entry, rb_node);
  462. ret += hist_entry__fprintf(fp, pos, total_samples);
  463. }
  464. return ret;
  465. }
  466. static int __cmd_report(void)
  467. {
  468. unsigned long offset = 0;
  469. unsigned long head = 0;
  470. struct stat stat;
  471. char *buf;
  472. event_t *event;
  473. int ret, rc = EXIT_FAILURE;
  474. uint32_t size;
  475. unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
  476. input = open(input_name, O_RDONLY);
  477. if (input < 0) {
  478. perror("failed to open file");
  479. exit(-1);
  480. }
  481. ret = fstat(input, &stat);
  482. if (ret < 0) {
  483. perror("failed to stat file");
  484. exit(-1);
  485. }
  486. if (!stat.st_size) {
  487. fprintf(stderr, "zero-sized file, nothing to do!\n");
  488. exit(0);
  489. }
  490. if (load_kernel() < 0) {
  491. perror("failed to load kernel symbols");
  492. return EXIT_FAILURE;
  493. }
  494. remap:
  495. buf = (char *)mmap(NULL, page_size * mmap_window, PROT_READ,
  496. MAP_SHARED, input, offset);
  497. if (buf == MAP_FAILED) {
  498. perror("failed to mmap file");
  499. exit(-1);
  500. }
  501. more:
  502. event = (event_t *)(buf + head);
  503. size = event->header.size;
  504. if (!size)
  505. size = 8;
  506. if (head + event->header.size >= page_size * mmap_window) {
  507. unsigned long shift = page_size * (head / page_size);
  508. int ret;
  509. ret = munmap(buf, page_size * mmap_window);
  510. assert(ret == 0);
  511. offset += shift;
  512. head -= shift;
  513. goto remap;
  514. }
  515. size = event->header.size;
  516. if (!size)
  517. goto broken_event;
  518. if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
  519. char level;
  520. int show = 0;
  521. struct dso *dso = NULL;
  522. struct thread *thread = threads__findnew(event->ip.pid);
  523. uint64_t ip = event->ip.ip;
  524. struct map *map = NULL;
  525. if (dump_trace) {
  526. fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
  527. (void *)(offset + head),
  528. (void *)(long)(event->header.size),
  529. event->header.misc,
  530. event->ip.pid,
  531. (void *)(long)ip);
  532. }
  533. if (thread == NULL) {
  534. fprintf(stderr, "problem processing %d event, skipping it.\n",
  535. event->header.type);
  536. goto broken_event;
  537. }
  538. if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
  539. show = SHOW_KERNEL;
  540. level = 'k';
  541. dso = kernel_dso;
  542. } else if (event->header.misc & PERF_EVENT_MISC_USER) {
  543. show = SHOW_USER;
  544. level = '.';
  545. map = thread__find_map(thread, ip);
  546. if (map != NULL) {
  547. dso = map->dso;
  548. ip -= map->start + map->pgoff;
  549. }
  550. } else {
  551. show = SHOW_HV;
  552. level = 'H';
  553. }
  554. if (show & show_mask) {
  555. struct symbol *sym = dso__find_symbol(dso, ip);
  556. if (hist_entry__add(thread, map, dso, sym, ip, level)) {
  557. fprintf(stderr,
  558. "problem incrementing symbol count, skipping event\n");
  559. goto broken_event;
  560. }
  561. }
  562. total++;
  563. } else switch (event->header.type) {
  564. case PERF_EVENT_MMAP: {
  565. struct thread *thread = threads__findnew(event->mmap.pid);
  566. struct map *map = map__new(&event->mmap);
  567. if (dump_trace) {
  568. fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
  569. (void *)(offset + head),
  570. (void *)(long)(event->header.size),
  571. (void *)(long)event->mmap.start,
  572. (void *)(long)event->mmap.len,
  573. (void *)(long)event->mmap.pgoff,
  574. event->mmap.filename);
  575. }
  576. if (thread == NULL || map == NULL) {
  577. fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
  578. goto broken_event;
  579. }
  580. thread__insert_map(thread, map);
  581. total_mmap++;
  582. break;
  583. }
  584. case PERF_EVENT_COMM: {
  585. struct thread *thread = threads__findnew(event->comm.pid);
  586. if (dump_trace) {
  587. fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n",
  588. (void *)(offset + head),
  589. (void *)(long)(event->header.size),
  590. event->comm.comm, event->comm.pid);
  591. }
  592. if (thread == NULL ||
  593. thread__set_comm(thread, event->comm.comm)) {
  594. fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
  595. goto broken_event;
  596. }
  597. total_comm++;
  598. break;
  599. }
  600. default: {
  601. broken_event:
  602. if (dump_trace)
  603. fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
  604. (void *)(offset + head),
  605. (void *)(long)(event->header.size),
  606. event->header.type);
  607. total_unknown++;
  608. /*
  609. * assume we lost track of the stream, check alignment, and
  610. * increment a single u64 in the hope to catch on again 'soon'.
  611. */
  612. if (unlikely(head & 7))
  613. head &= ~7ULL;
  614. size = 8;
  615. }
  616. }
  617. head += size;
  618. if (offset + head < stat.st_size)
  619. goto more;
  620. rc = EXIT_SUCCESS;
  621. close(input);
  622. if (dump_trace) {
  623. fprintf(stderr, " IP events: %10ld\n", total);
  624. fprintf(stderr, " mmap events: %10ld\n", total_mmap);
  625. fprintf(stderr, " comm events: %10ld\n", total_comm);
  626. fprintf(stderr, " unknown events: %10ld\n", total_unknown);
  627. return 0;
  628. }
  629. if (verbose >= 2)
  630. dsos__fprintf(stdout);
  631. output__resort();
  632. output__fprintf(stdout, total);
  633. return rc;
  634. }
  635. static const char * const report_usage[] = {
  636. "perf report [<options>] <command>",
  637. NULL
  638. };
  639. static const struct option options[] = {
  640. OPT_STRING('i', "input", &input_name, "file",
  641. "input file name"),
  642. OPT_BOOLEAN('v', "verbose", &verbose,
  643. "be more verbose (show symbol address, etc)"),
  644. OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
  645. "dump raw trace in ASCII"),
  646. OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
  647. OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
  648. "sort by key(s): pid, comm, dso, symbol. Default: pid,symbol"),
  649. OPT_END()
  650. };
  651. int cmd_report(int argc, const char **argv, const char *prefix)
  652. {
  653. symbol__init();
  654. page_size = getpagesize();
  655. parse_options(argc, argv, options, report_usage, 0);
  656. setup_sorting();
  657. setup_pager();
  658. return __cmd_report();
  659. }