aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-04 08:13:04 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-04 08:16:38 -0400
commitbd74137ec9aaca3df3ff22b92455fddf7afaced1 (patch)
tree8b96fa45fd3104f56bb0122b6215c0e7202df825 /Documentation
parent95ed6fd06e52bf850cd17524f0b36ed14300c10d (diff)
perf_counter tools: Print out symbol parsing errors only if --verbose
Also, add a suggestion to 'perf report', if the default sort order is used. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/perf_counter/builtin-report.c18
-rw-r--r--Documentation/perf_counter/builtin-top.c2
-rw-r--r--Documentation/perf_counter/util/symbol.c27
-rw-r--r--Documentation/perf_counter/util/symbol.h4
4 files changed, 32 insertions, 19 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 56c664d1b628..15fe9dae792b 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -26,7 +26,10 @@
26 26
27static char const *input_name = "perf.data"; 27static char const *input_name = "perf.data";
28static char *vmlinux = NULL; 28static char *vmlinux = NULL;
29static char *sort_order = "comm,dso"; 29
30static char default_sort_order[] = "comm,dso";
31static char *sort_order = default_sort_order;
32
30static int input; 33static int input;
31static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; 34static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
32 35
@@ -103,9 +106,10 @@ static struct dso *dsos__findnew(const char *name)
103 if (!dso) 106 if (!dso)
104 goto out_delete_dso; 107 goto out_delete_dso;
105 108
106 nr = dso__load(dso, NULL); 109 nr = dso__load(dso, NULL, verbose);
107 if (nr < 0) { 110 if (nr < 0) {
108 fprintf(stderr, "Failed to open: %s\n", name); 111 if (verbose)
112 fprintf(stderr, "Failed to open: %s\n", name);
109 goto out_delete_dso; 113 goto out_delete_dso;
110 } 114 }
111 if (!nr && verbose) { 115 if (!nr && verbose) {
@@ -139,7 +143,7 @@ static int load_kernel(void)
139 if (!kernel_dso) 143 if (!kernel_dso)
140 return -1; 144 return -1;
141 145
142 err = dso__load_kernel(kernel_dso, vmlinux, NULL); 146 err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose);
143 if (err) { 147 if (err) {
144 dso__delete(kernel_dso); 148 dso__delete(kernel_dso);
145 kernel_dso = NULL; 149 kernel_dso = NULL;
@@ -741,6 +745,12 @@ static size_t output__fprintf(FILE *fp, uint64_t total_samples)
741 ret += hist_entry__fprintf(fp, pos, total_samples); 745 ret += hist_entry__fprintf(fp, pos, total_samples);
742 } 746 }
743 747
748 if (!strcmp(sort_order, default_sort_order)) {
749 fprintf(fp, "#\n");
750 fprintf(fp, "# ( For more details, try: perf report --sort comm,dso,symbol )\n");
751 fprintf(fp, "#\n");
752 }
753
744 return ret; 754 return ret;
745} 755}
746 756
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index 3f7778ba00bc..548a8da4b15b 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -349,7 +349,7 @@ static int parse_symbols(void)
349 if (kernel_dso == NULL) 349 if (kernel_dso == NULL)
350 return -1; 350 return -1;
351 351
352 if (dso__load_kernel(kernel_dso, NULL, symbol_filter) != 0) 352 if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) != 0)
353 goto out_delete_dso; 353 goto out_delete_dso;
354 354
355 node = rb_first(&kernel_dso->syms); 355 node = rb_first(&kernel_dso->syms);
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
index 35ee6de1e513..15d5cf9abfac 100644
--- a/Documentation/perf_counter/util/symbol.c
+++ b/Documentation/perf_counter/util/symbol.c
@@ -124,7 +124,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp)
124 return ret; 124 return ret;
125} 125}
126 126
127static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter) 127static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verbose)
128{ 128{
129 struct rb_node *nd, *prevnd; 129 struct rb_node *nd, *prevnd;
130 char *line = NULL; 130 char *line = NULL;
@@ -370,7 +370,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf,
370} 370}
371 371
372static int dso__load_sym(struct dso *self, int fd, const char *name, 372static int dso__load_sym(struct dso *self, int fd, const char *name,
373 symbol_filter_t filter) 373 symbol_filter_t filter, int verbose)
374{ 374{
375 Elf_Data *symstrs; 375 Elf_Data *symstrs;
376 uint32_t nr_syms; 376 uint32_t nr_syms;
@@ -387,13 +387,15 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
387 387
388 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 388 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
389 if (elf == NULL) { 389 if (elf == NULL) {
390 fprintf(stderr, "%s: cannot read %s ELF file.\n", 390 if (verbose)
391 __func__, name); 391 fprintf(stderr, "%s: cannot read %s ELF file.\n",
392 __func__, name);
392 goto out_close; 393 goto out_close;
393 } 394 }
394 395
395 if (gelf_getehdr(elf, &ehdr) == NULL) { 396 if (gelf_getehdr(elf, &ehdr) == NULL) {
396 fprintf(stderr, "%s: cannot get elf header.\n", __func__); 397 if (verbose)
398 fprintf(stderr, "%s: cannot get elf header.\n", __func__);
397 goto out_elf_end; 399 goto out_elf_end;
398 } 400 }
399 401
@@ -473,7 +475,7 @@ out_close:
473 return err; 475 return err;
474} 476}
475 477
476int dso__load(struct dso *self, symbol_filter_t filter) 478int dso__load(struct dso *self, symbol_filter_t filter, int verbose)
477{ 479{
478 int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug"); 480 int size = strlen(self->name) + sizeof("/usr/lib/debug%s.debug");
479 char *name = malloc(size); 481 char *name = malloc(size);
@@ -505,7 +507,7 @@ more:
505 fd = open(name, O_RDONLY); 507 fd = open(name, O_RDONLY);
506 } while (fd < 0); 508 } while (fd < 0);
507 509
508 ret = dso__load_sym(self, fd, name, filter); 510 ret = dso__load_sym(self, fd, name, filter, verbose);
509 close(fd); 511 close(fd);
510 512
511 /* 513 /*
@@ -520,28 +522,29 @@ out:
520} 522}
521 523
522static int dso__load_vmlinux(struct dso *self, const char *vmlinux, 524static int dso__load_vmlinux(struct dso *self, const char *vmlinux,
523 symbol_filter_t filter) 525 symbol_filter_t filter, int verbose)
524{ 526{
525 int err, fd = open(vmlinux, O_RDONLY); 527 int err, fd = open(vmlinux, O_RDONLY);
526 528
527 if (fd < 0) 529 if (fd < 0)
528 return -1; 530 return -1;
529 531
530 err = dso__load_sym(self, fd, vmlinux, filter); 532 err = dso__load_sym(self, fd, vmlinux, filter, verbose);
531 close(fd); 533 close(fd);
532 534
533 return err; 535 return err;
534} 536}
535 537
536int dso__load_kernel(struct dso *self, const char *vmlinux, symbol_filter_t filter) 538int dso__load_kernel(struct dso *self, const char *vmlinux,
539 symbol_filter_t filter, int verbose)
537{ 540{
538 int err = -1; 541 int err = -1;
539 542
540 if (vmlinux) 543 if (vmlinux)
541 err = dso__load_vmlinux(self, vmlinux, filter); 544 err = dso__load_vmlinux(self, vmlinux, filter, verbose);
542 545
543 if (err) 546 if (err)
544 err = dso__load_kallsyms(self, filter); 547 err = dso__load_kallsyms(self, filter, verbose);
545 548
546 return err; 549 return err;
547} 550}
diff --git a/Documentation/perf_counter/util/symbol.h b/Documentation/perf_counter/util/symbol.h
index b0299bc0cf50..8dd8522a0a0c 100644
--- a/Documentation/perf_counter/util/symbol.h
+++ b/Documentation/perf_counter/util/symbol.h
@@ -32,8 +32,8 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
32struct symbol *dso__find_symbol(struct dso *self, uint64_t ip); 32struct symbol *dso__find_symbol(struct dso *self, uint64_t ip);
33 33
34int dso__load_kernel(struct dso *self, const char *vmlinux, 34int dso__load_kernel(struct dso *self, const char *vmlinux,
35 symbol_filter_t filter); 35 symbol_filter_t filter, int verbose);
36int dso__load(struct dso *self, symbol_filter_t filter); 36int dso__load(struct dso *self, symbol_filter_t filter, int verbose);
37 37
38size_t dso__fprintf(struct dso *self, FILE *fp); 38size_t dso__fprintf(struct dso *self, FILE *fp);
39 39