aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-07-22 14:41:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-07-22 14:41:56 -0400
commit3c3301083e3bea4d14c597106c7b20b4b85fc03d (patch)
tree6eabdd073bdc27eb3f0dd999ea946955afca18bf /tools/perf/builtin-report.c
parent612e900c286a9535cc17da5171b0d8dcf8f3a12f (diff)
parent0fdc7e67dd312986e30b861adff48732bd33eb3f (diff)
Merge branch 'perf-counters-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-perf
* 'perf-counters-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-perf: (31 commits) perf_counter tools: Give perf top inherit option perf_counter tools: Fix vmlinux symbol generation breakage perf_counter: Detect debugfs location perf_counter: Add tracepoint support to perf list, perf stat perf symbol: C++ demangling perf: avoid structure size confusion by using a fixed size perf_counter: Fix throttle/unthrottle event logging perf_counter: Improve perf stat and perf record option parsing perf_counter: PERF_SAMPLE_ID and inherited counters perf_counter: Plug more stack leaks perf: Fix stack data leak perf_counter: Remove unused variables perf_counter: Make call graph option consistent perf_counter: Add perf record option to log addresses perf_counter: Log vfork as a fork event perf_counter: Synthesize VDSO mmap event perf_counter: Make sure we dont leak kernel memory to userspace perf_counter tools: Fix index boundary check perf_counter: Fix the tracepoint channel to perfcounters perf_counter, x86: Extend perf_counter Pentium M support ...
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c255
1 files changed, 182 insertions, 73 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 4e5cc266311e..b20a4b6e31b7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -33,8 +33,10 @@ static char *vmlinux = NULL;
33 33
34static char default_sort_order[] = "comm,dso"; 34static char default_sort_order[] = "comm,dso";
35static char *sort_order = default_sort_order; 35static char *sort_order = default_sort_order;
36static char *dso_list_str, *comm_list_str, *sym_list_str; 36static char *dso_list_str, *comm_list_str, *sym_list_str,
37 *col_width_list_str;
37static struct strlist *dso_list, *comm_list, *sym_list; 38static struct strlist *dso_list, *comm_list, *sym_list;
39static char *field_sep;
38 40
39static int input; 41static int input;
40static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; 42static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@@ -49,6 +51,7 @@ static int verbose;
49static int modules; 51static int modules;
50 52
51static int full_paths; 53static int full_paths;
54static int show_nr_samples;
52 55
53static unsigned long page_size; 56static unsigned long page_size;
54static unsigned long mmap_window = 32; 57static unsigned long mmap_window = 32;
@@ -98,13 +101,6 @@ struct fork_event {
98 u32 pid, ppid; 101 u32 pid, ppid;
99}; 102};
100 103
101struct period_event {
102 struct perf_event_header header;
103 u64 time;
104 u64 id;
105 u64 sample_period;
106};
107
108struct lost_event { 104struct lost_event {
109 struct perf_event_header header; 105 struct perf_event_header header;
110 u64 id; 106 u64 id;
@@ -124,11 +120,37 @@ typedef union event_union {
124 struct mmap_event mmap; 120 struct mmap_event mmap;
125 struct comm_event comm; 121 struct comm_event comm;
126 struct fork_event fork; 122 struct fork_event fork;
127 struct period_event period;
128 struct lost_event lost; 123 struct lost_event lost;
129 struct read_event read; 124 struct read_event read;
130} event_t; 125} event_t;
131 126
127static int repsep_fprintf(FILE *fp, const char *fmt, ...)
128{
129 int n;
130 va_list ap;
131
132 va_start(ap, fmt);
133 if (!field_sep)
134 n = vfprintf(fp, fmt, ap);
135 else {
136 char *bf = NULL;
137 n = vasprintf(&bf, fmt, ap);
138 if (n > 0) {
139 char *sep = bf;
140 while (1) {
141 sep = strchr(sep, *field_sep);
142 if (sep == NULL)
143 break;
144 *sep = '.';
145 }
146 }
147 fputs(bf, fp);
148 free(bf);
149 }
150 va_end(ap);
151 return n;
152}
153
132static LIST_HEAD(dsos); 154static LIST_HEAD(dsos);
133static struct dso *kernel_dso; 155static struct dso *kernel_dso;
134static struct dso *vdso; 156static struct dso *vdso;
@@ -360,12 +382,28 @@ static struct thread *thread__new(pid_t pid)
360 return self; 382 return self;
361} 383}
362 384
385static unsigned int dsos__col_width,
386 comms__col_width,
387 threads__col_width;
388
363static int thread__set_comm(struct thread *self, const char *comm) 389static int thread__set_comm(struct thread *self, const char *comm)
364{ 390{
365 if (self->comm) 391 if (self->comm)
366 free(self->comm); 392 free(self->comm);
367 self->comm = strdup(comm); 393 self->comm = strdup(comm);
368 return self->comm ? 0 : -ENOMEM; 394 if (!self->comm)
395 return -ENOMEM;
396
397 if (!col_width_list_str && !field_sep &&
398 (!comm_list || strlist__has_entry(comm_list, comm))) {
399 unsigned int slen = strlen(comm);
400 if (slen > comms__col_width) {
401 comms__col_width = slen;
402 threads__col_width = slen + 6;
403 }
404 }
405
406 return 0;
369} 407}
370 408
371static size_t thread__fprintf(struct thread *self, FILE *fp) 409static size_t thread__fprintf(struct thread *self, FILE *fp)
@@ -536,7 +574,9 @@ struct sort_entry {
536 574
537 int64_t (*cmp)(struct hist_entry *, struct hist_entry *); 575 int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
538 int64_t (*collapse)(struct hist_entry *, struct hist_entry *); 576 int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
539 size_t (*print)(FILE *fp, struct hist_entry *); 577 size_t (*print)(FILE *fp, struct hist_entry *, unsigned int width);
578 unsigned int *width;
579 bool elide;
540}; 580};
541 581
542static int64_t cmp_null(void *l, void *r) 582static int64_t cmp_null(void *l, void *r)
@@ -558,15 +598,17 @@ sort__thread_cmp(struct hist_entry *left, struct hist_entry *right)
558} 598}
559 599
560static size_t 600static size_t
561sort__thread_print(FILE *fp, struct hist_entry *self) 601sort__thread_print(FILE *fp, struct hist_entry *self, unsigned int width)
562{ 602{
563 return fprintf(fp, "%16s:%5d", self->thread->comm ?: "", self->thread->pid); 603 return repsep_fprintf(fp, "%*s:%5d", width - 6,
604 self->thread->comm ?: "", self->thread->pid);
564} 605}
565 606
566static struct sort_entry sort_thread = { 607static struct sort_entry sort_thread = {
567 .header = " Command: Pid", 608 .header = "Command: Pid",
568 .cmp = sort__thread_cmp, 609 .cmp = sort__thread_cmp,
569 .print = sort__thread_print, 610 .print = sort__thread_print,
611 .width = &threads__col_width,
570}; 612};
571 613
572/* --sort comm */ 614/* --sort comm */
@@ -590,16 +632,17 @@ sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
590} 632}
591 633
592static size_t 634static size_t
593sort__comm_print(FILE *fp, struct hist_entry *self) 635sort__comm_print(FILE *fp, struct hist_entry *self, unsigned int width)
594{ 636{
595 return fprintf(fp, "%16s", self->thread->comm); 637 return repsep_fprintf(fp, "%*s", width, self->thread->comm);
596} 638}
597 639
598static struct sort_entry sort_comm = { 640static struct sort_entry sort_comm = {
599 .header = " Command", 641 .header = "Command",
600 .cmp = sort__comm_cmp, 642 .cmp = sort__comm_cmp,
601 .collapse = sort__comm_collapse, 643 .collapse = sort__comm_collapse,
602 .print = sort__comm_print, 644 .print = sort__comm_print,
645 .width = &comms__col_width,
603}; 646};
604 647
605/* --sort dso */ 648/* --sort dso */
@@ -617,18 +660,19 @@ sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
617} 660}
618 661
619static size_t 662static size_t
620sort__dso_print(FILE *fp, struct hist_entry *self) 663sort__dso_print(FILE *fp, struct hist_entry *self, unsigned int width)
621{ 664{
622 if (self->dso) 665 if (self->dso)
623 return fprintf(fp, "%-25s", self->dso->name); 666 return repsep_fprintf(fp, "%-*s", width, self->dso->name);
624 667
625 return fprintf(fp, "%016llx ", (u64)self->ip); 668 return repsep_fprintf(fp, "%*llx", width, (u64)self->ip);
626} 669}
627 670
628static struct sort_entry sort_dso = { 671static struct sort_entry sort_dso = {
629 .header = "Shared Object ", 672 .header = "Shared Object",
630 .cmp = sort__dso_cmp, 673 .cmp = sort__dso_cmp,
631 .print = sort__dso_print, 674 .print = sort__dso_print,
675 .width = &dsos__col_width,
632}; 676};
633 677
634/* --sort symbol */ 678/* --sort symbol */
@@ -648,22 +692,22 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
648} 692}
649 693
650static size_t 694static size_t
651sort__sym_print(FILE *fp, struct hist_entry *self) 695sort__sym_print(FILE *fp, struct hist_entry *self, unsigned int width __used)
652{ 696{
653 size_t ret = 0; 697 size_t ret = 0;
654 698
655 if (verbose) 699 if (verbose)
656 ret += fprintf(fp, "%#018llx ", (u64)self->ip); 700 ret += repsep_fprintf(fp, "%#018llx ", (u64)self->ip);
657 701
702 ret += repsep_fprintf(fp, "[%c] ", self->level);
658 if (self->sym) { 703 if (self->sym) {
659 ret += fprintf(fp, "[%c] %s", 704 ret += repsep_fprintf(fp, "%s", self->sym->name);
660 self->dso == kernel_dso ? 'k' :
661 self->dso == hypervisor_dso ? 'h' : '.', self->sym->name);
662 705
663 if (self->sym->module) 706 if (self->sym->module)
664 ret += fprintf(fp, "\t[%s]", self->sym->module->name); 707 ret += repsep_fprintf(fp, "\t[%s]",
708 self->sym->module->name);
665 } else { 709 } else {
666 ret += fprintf(fp, "%#016llx", (u64)self->ip); 710 ret += repsep_fprintf(fp, "%#016llx", (u64)self->ip);
667 } 711 }
668 712
669 return ret; 713 return ret;
@@ -690,19 +734,19 @@ sort__parent_cmp(struct hist_entry *left, struct hist_entry *right)
690} 734}
691 735
692static size_t 736static size_t
693sort__parent_print(FILE *fp, struct hist_entry *self) 737sort__parent_print(FILE *fp, struct hist_entry *self, unsigned int width)
694{ 738{
695 size_t ret = 0; 739 return repsep_fprintf(fp, "%-*s", width,
696 740 self->parent ? self->parent->name : "[other]");
697 ret += fprintf(fp, "%-20s", self->parent ? self->parent->name : "[other]");
698
699 return ret;
700} 741}
701 742
743static unsigned int parent_symbol__col_width;
744
702static struct sort_entry sort_parent = { 745static struct sort_entry sort_parent = {
703 .header = "Parent symbol ", 746 .header = "Parent symbol",
704 .cmp = sort__parent_cmp, 747 .cmp = sort__parent_cmp,
705 .print = sort__parent_print, 748 .print = sort__parent_print,
749 .width = &parent_symbol__col_width,
706}; 750};
707 751
708static int sort__need_collapse = 0; 752static int sort__need_collapse = 0;
@@ -967,17 +1011,25 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples)
967 return 0; 1011 return 0;
968 1012
969 if (total_samples) 1013 if (total_samples)
970 ret = percent_color_fprintf(fp, " %6.2f%%", 1014 ret = percent_color_fprintf(fp,
971 (self->count * 100.0) / total_samples); 1015 field_sep ? "%.2f" : " %6.2f%%",
1016 (self->count * 100.0) / total_samples);
972 else 1017 else
973 ret = fprintf(fp, "%12Ld ", self->count); 1018 ret = fprintf(fp, field_sep ? "%lld" : "%12lld ", self->count);
1019
1020 if (show_nr_samples) {
1021 if (field_sep)
1022 fprintf(fp, "%c%lld", *field_sep, self->count);
1023 else
1024 fprintf(fp, "%11lld", self->count);
1025 }
974 1026
975 list_for_each_entry(se, &hist_entry__sort_list, list) { 1027 list_for_each_entry(se, &hist_entry__sort_list, list) {
976 if (exclude_other && (se == &sort_parent)) 1028 if (se->elide)
977 continue; 1029 continue;
978 1030
979 fprintf(fp, " "); 1031 fprintf(fp, "%s", field_sep ?: " ");
980 ret += se->print(fp, self); 1032 ret += se->print(fp, self, se->width ? *se->width : 0);
981 } 1033 }
982 1034
983 ret += fprintf(fp, "\n"); 1035 ret += fprintf(fp, "\n");
@@ -992,6 +1044,18 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples)
992 * 1044 *
993 */ 1045 */
994 1046
1047static void dso__calc_col_width(struct dso *self)
1048{
1049 if (!col_width_list_str && !field_sep &&
1050 (!dso_list || strlist__has_entry(dso_list, self->name))) {
1051 unsigned int slen = strlen(self->name);
1052 if (slen > dsos__col_width)
1053 dsos__col_width = slen;
1054 }
1055
1056 self->slen_calculated = 1;
1057}
1058
995static struct symbol * 1059static struct symbol *
996resolve_symbol(struct thread *thread, struct map **mapp, 1060resolve_symbol(struct thread *thread, struct map **mapp,
997 struct dso **dsop, u64 *ipp) 1061 struct dso **dsop, u64 *ipp)
@@ -1011,6 +1075,14 @@ resolve_symbol(struct thread *thread, struct map **mapp,
1011 1075
1012 map = thread__find_map(thread, ip); 1076 map = thread__find_map(thread, ip);
1013 if (map != NULL) { 1077 if (map != NULL) {
1078 /*
1079 * We have to do this here as we may have a dso
1080 * with no symbol hit that has a name longer than
1081 * the ones with symbols sampled.
1082 */
1083 if (!sort_dso.elide && !map->dso->slen_calculated)
1084 dso__calc_col_width(map->dso);
1085
1014 if (mapp) 1086 if (mapp)
1015 *mapp = map; 1087 *mapp = map;
1016got_map: 1088got_map:
@@ -1282,35 +1354,67 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
1282 struct sort_entry *se; 1354 struct sort_entry *se;
1283 struct rb_node *nd; 1355 struct rb_node *nd;
1284 size_t ret = 0; 1356 size_t ret = 0;
1357 unsigned int width;
1358 char *col_width = col_width_list_str;
1285 1359
1286 fprintf(fp, "\n"); 1360 fprintf(fp, "# Samples: %Ld\n", (u64)total_samples);
1287 fprintf(fp, "#\n");
1288 fprintf(fp, "# (%Ld samples)\n", (u64)total_samples);
1289 fprintf(fp, "#\n"); 1361 fprintf(fp, "#\n");
1290 1362
1291 fprintf(fp, "# Overhead"); 1363 fprintf(fp, "# Overhead");
1364 if (show_nr_samples) {
1365 if (field_sep)
1366 fprintf(fp, "%cSamples", *field_sep);
1367 else
1368 fputs(" Samples ", fp);
1369 }
1292 list_for_each_entry(se, &hist_entry__sort_list, list) { 1370 list_for_each_entry(se, &hist_entry__sort_list, list) {
1293 if (exclude_other && (se == &sort_parent)) 1371 if (se->elide)
1294 continue; 1372 continue;
1295 fprintf(fp, " %s", se->header); 1373 if (field_sep) {
1374 fprintf(fp, "%c%s", *field_sep, se->header);
1375 continue;
1376 }
1377 width = strlen(se->header);
1378 if (se->width) {
1379 if (col_width_list_str) {
1380 if (col_width) {
1381 *se->width = atoi(col_width);
1382 col_width = strchr(col_width, ',');
1383 if (col_width)
1384 ++col_width;
1385 }
1386 }
1387 width = *se->width = max(*se->width, width);
1388 }
1389 fprintf(fp, " %*s", width, se->header);
1296 } 1390 }
1297 fprintf(fp, "\n"); 1391 fprintf(fp, "\n");
1298 1392
1393 if (field_sep)
1394 goto print_entries;
1395
1299 fprintf(fp, "# ........"); 1396 fprintf(fp, "# ........");
1397 if (show_nr_samples)
1398 fprintf(fp, " ..........");
1300 list_for_each_entry(se, &hist_entry__sort_list, list) { 1399 list_for_each_entry(se, &hist_entry__sort_list, list) {
1301 unsigned int i; 1400 unsigned int i;
1302 1401
1303 if (exclude_other && (se == &sort_parent)) 1402 if (se->elide)
1304 continue; 1403 continue;
1305 1404
1306 fprintf(fp, " "); 1405 fprintf(fp, " ");
1307 for (i = 0; i < strlen(se->header); i++) 1406 if (se->width)
1407 width = *se->width;
1408 else
1409 width = strlen(se->header);
1410 for (i = 0; i < width; i++)
1308 fprintf(fp, "."); 1411 fprintf(fp, ".");
1309 } 1412 }
1310 fprintf(fp, "\n"); 1413 fprintf(fp, "\n");
1311 1414
1312 fprintf(fp, "#\n"); 1415 fprintf(fp, "#\n");
1313 1416
1417print_entries:
1314 for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) { 1418 for (nd = rb_first(&output_hists); nd; nd = rb_next(nd)) {
1315 pos = rb_entry(nd, struct hist_entry, rb_node); 1419 pos = rb_entry(nd, struct hist_entry, rb_node);
1316 ret += hist_entry__fprintf(fp, pos, total_samples); 1420 ret += hist_entry__fprintf(fp, pos, total_samples);
@@ -1524,19 +1628,6 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
1524} 1628}
1525 1629
1526static int 1630static int
1527process_period_event(event_t *event, unsigned long offset, unsigned long head)
1528{
1529 dprintf("%p [%p]: PERF_EVENT_PERIOD: time:%Ld, id:%Ld: period:%Ld\n",
1530 (void *)(offset + head),
1531 (void *)(long)(event->header.size),
1532 event->period.time,
1533 event->period.id,
1534 event->period.sample_period);
1535
1536 return 0;
1537}
1538
1539static int
1540process_lost_event(event_t *event, unsigned long offset, unsigned long head) 1631process_lost_event(event_t *event, unsigned long offset, unsigned long head)
1541{ 1632{
1542 dprintf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n", 1633 dprintf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n",
@@ -1617,9 +1708,6 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
1617 case PERF_EVENT_FORK: 1708 case PERF_EVENT_FORK:
1618 return process_fork_event(event, offset, head); 1709 return process_fork_event(event, offset, head);
1619 1710
1620 case PERF_EVENT_PERIOD:
1621 return process_period_event(event, offset, head);
1622
1623 case PERF_EVENT_LOST: 1711 case PERF_EVENT_LOST:
1624 return process_lost_event(event, offset, head); 1712 return process_lost_event(event, offset, head);
1625 1713
@@ -1883,6 +1971,8 @@ static const struct option options[] = {
1883 OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), 1971 OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
1884 OPT_BOOLEAN('m', "modules", &modules, 1972 OPT_BOOLEAN('m', "modules", &modules,
1885 "load module symbols - WARNING: use only with -k and LIVE kernel"), 1973 "load module symbols - WARNING: use only with -k and LIVE kernel"),
1974 OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
1975 "Show a column with the number of samples"),
1886 OPT_STRING('s', "sort", &sort_order, "key[,key2...]", 1976 OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
1887 "sort by key(s): pid, comm, dso, symbol, parent"), 1977 "sort by key(s): pid, comm, dso, symbol, parent"),
1888 OPT_BOOLEAN('P', "full-paths", &full_paths, 1978 OPT_BOOLEAN('P', "full-paths", &full_paths,
@@ -1891,15 +1981,21 @@ static const struct option options[] = {
1891 "regex filter to identify parent, see: '--sort parent'"), 1981 "regex filter to identify parent, see: '--sort parent'"),
1892 OPT_BOOLEAN('x', "exclude-other", &exclude_other, 1982 OPT_BOOLEAN('x', "exclude-other", &exclude_other,
1893 "Only display entries with parent-match"), 1983 "Only display entries with parent-match"),
1894 OPT_CALLBACK_DEFAULT('c', "callchain", NULL, "output_type,min_percent", 1984 OPT_CALLBACK_DEFAULT('g', "call-graph", NULL, "output_type,min_percent",
1895 "Display callchains using output_type and min percent threshold. " 1985 "Display callchains using output_type and min percent threshold. "
1896 "Default: flat,0", &parse_callchain_opt, callchain_default_opt), 1986 "Default: fractal,0.5", &parse_callchain_opt, callchain_default_opt),
1897 OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]", 1987 OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]",
1898 "only consider symbols in these dsos"), 1988 "only consider symbols in these dsos"),
1899 OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]", 1989 OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]",
1900 "only consider symbols in these comms"), 1990 "only consider symbols in these comms"),
1901 OPT_STRING('S', "symbols", &sym_list_str, "symbol[,symbol...]", 1991 OPT_STRING('S', "symbols", &sym_list_str, "symbol[,symbol...]",
1902 "only consider these symbols"), 1992 "only consider these symbols"),
1993 OPT_STRING('w', "column-widths", &col_width_list_str,
1994 "width[,width...]",
1995 "don't try to adjust column width, use these fixed values"),
1996 OPT_STRING('t', "field-separator", &field_sep, "separator",
1997 "separator for columns, no spaces will be added between "
1998 "columns '.' is reserved."),
1903 OPT_END() 1999 OPT_END()
1904}; 2000};
1905 2001
@@ -1919,7 +2015,8 @@ static void setup_sorting(void)
1919} 2015}
1920 2016
1921static void setup_list(struct strlist **list, const char *list_str, 2017static void setup_list(struct strlist **list, const char *list_str,
1922 const char *list_name) 2018 struct sort_entry *se, const char *list_name,
2019 FILE *fp)
1923{ 2020{
1924 if (list_str) { 2021 if (list_str) {
1925 *list = strlist__new(true, list_str); 2022 *list = strlist__new(true, list_str);
@@ -1928,6 +2025,11 @@ static void setup_list(struct strlist **list, const char *list_str,
1928 list_name); 2025 list_name);
1929 exit(129); 2026 exit(129);
1930 } 2027 }
2028 if (strlist__nr_entries(*list) == 1) {
2029 fprintf(fp, "# %s: %s\n", list_name,
2030 strlist__entry(*list, 0)->s);
2031 se->elide = true;
2032 }
1931 } 2033 }
1932} 2034}
1933 2035
@@ -1941,9 +2043,10 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
1941 2043
1942 setup_sorting(); 2044 setup_sorting();
1943 2045
1944 if (parent_pattern != default_parent_pattern) 2046 if (parent_pattern != default_parent_pattern) {
1945 sort_dimension__add("parent"); 2047 sort_dimension__add("parent");
1946 else 2048 sort_parent.elide = 1;
2049 } else
1947 exclude_other = 0; 2050 exclude_other = 0;
1948 2051
1949 /* 2052 /*
@@ -1952,11 +2055,17 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
1952 if (argc) 2055 if (argc)
1953 usage_with_options(report_usage, options); 2056 usage_with_options(report_usage, options);
1954 2057
1955 setup_list(&dso_list, dso_list_str, "dso");
1956 setup_list(&comm_list, comm_list_str, "comm");
1957 setup_list(&sym_list, sym_list_str, "symbol");
1958
1959 setup_pager(); 2058 setup_pager();
1960 2059
2060 setup_list(&dso_list, dso_list_str, &sort_dso, "dso", stdout);
2061 setup_list(&comm_list, comm_list_str, &sort_comm, "comm", stdout);
2062 setup_list(&sym_list, sym_list_str, &sort_sym, "symbol", stdout);
2063
2064 if (field_sep && *field_sep == '.') {
2065 fputs("'.' is the only non valid --field-separator argument\n",
2066 stderr);
2067 exit(129);
2068 }
2069
1961 return __cmd_report(); 2070 return __cmd_report();
1962} 2071}