aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2009-07-02 02:09:46 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-02 02:42:21 -0400
commit429764873cf3fc3e73142872a674bb27cda589c1 (patch)
treea7c11887ad7aa055f56276a14acbe004d0ead434 /tools/perf/builtin-top.c
parent6cfcc53ed4f3ecb9319e73a03f34f1eddcb644dd (diff)
perf_counter tools: Enable kernel module symbol loading in tools
Add the -m/--modules option to perf report and perf annotate, which enables live module symbol/image loading. To be used with -k/--vmlinux. (Also give perf annotate a -P/--full-paths option.) Signed-off-by: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <1246514986.13293.48.camel@marge.simson.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 9bb25fc3d4ce..aa044ea1482b 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -66,6 +66,7 @@ static unsigned int page_size;
66static unsigned int mmap_pages = 16; 66static unsigned int mmap_pages = 16;
67static int freq = 0; 67static int freq = 0;
68static int verbose = 0; 68static int verbose = 0;
69static char *vmlinux = NULL;
69 70
70static char *sym_filter; 71static char *sym_filter;
71static unsigned long filter_start; 72static unsigned long filter_start;
@@ -265,7 +266,10 @@ static void print_sym_table(void)
265 printf("%9.1f %10ld - ", syme->weight, syme->snap_count); 266 printf("%9.1f %10ld - ", syme->weight, syme->snap_count);
266 267
267 color_fprintf(stdout, color, "%4.1f%%", pcnt); 268 color_fprintf(stdout, color, "%4.1f%%", pcnt);
268 printf(" - %016llx : %s\n", sym->start, sym->name); 269 printf(" - %016llx : %s", sym->start, sym->name);
270 if (sym->module)
271 printf("\t[%s]", sym->module->name);
272 printf("\n");
269 } 273 }
270} 274}
271 275
@@ -359,12 +363,13 @@ static int parse_symbols(void)
359{ 363{
360 struct rb_node *node; 364 struct rb_node *node;
361 struct symbol *sym; 365 struct symbol *sym;
366 int modules = vmlinux ? 1 : 0;
362 367
363 kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry)); 368 kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry));
364 if (kernel_dso == NULL) 369 if (kernel_dso == NULL)
365 return -1; 370 return -1;
366 371
367 if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1, 0) <= 0) 372 if (dso__load_kernel(kernel_dso, vmlinux, symbol_filter, verbose, modules) <= 0)
368 goto out_delete_dso; 373 goto out_delete_dso;
369 374
370 node = rb_first(&kernel_dso->syms); 375 node = rb_first(&kernel_dso->syms);
@@ -680,6 +685,7 @@ static const struct option options[] = {
680 "system-wide collection from all CPUs"), 685 "system-wide collection from all CPUs"),
681 OPT_INTEGER('C', "CPU", &profile_cpu, 686 OPT_INTEGER('C', "CPU", &profile_cpu,
682 "CPU to profile on"), 687 "CPU to profile on"),
688 OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
683 OPT_INTEGER('m', "mmap-pages", &mmap_pages, 689 OPT_INTEGER('m', "mmap-pages", &mmap_pages,
684 "number of mmap data pages"), 690 "number of mmap data pages"),
685 OPT_INTEGER('r', "realtime", &realtime_prio, 691 OPT_INTEGER('r', "realtime", &realtime_prio,
@@ -709,6 +715,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
709{ 715{
710 int counter; 716 int counter;
711 717
718 symbol__init();
719
712 page_size = sysconf(_SC_PAGE_SIZE); 720 page_size = sysconf(_SC_PAGE_SIZE);
713 721
714 argc = parse_options(argc, argv, options, top_usage, 0); 722 argc = parse_options(argc, argv, options, top_usage, 0);