diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-05-27 14:20:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-27 15:44:12 -0400 |
commit | 450aaa2b2a1b006870ba68251fbb40b2387caade (patch) | |
tree | 224048f843b87482a1a21f1f13062b01a485b5f3 /Documentation/perf_counter/builtin-report.c | |
parent | b7a16eac5e679fb5f531b9eeff7db7952303e77d (diff) |
perf_counter: tools: report: Add vmlinux support
Allow to use vmlinux instead of kallsyms.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <20090527182100.740018486@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/builtin-report.c')
-rw-r--r-- | Documentation/perf_counter/builtin-report.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index a9ff49a4edea..3e87cbd3045a 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #define SHOW_HV 4 | 19 | #define SHOW_HV 4 |
20 | 20 | ||
21 | static char const *input_name = "perf.data"; | 21 | static char const *input_name = "perf.data"; |
22 | static char *vmlinux = NULL; | ||
22 | static int input; | 23 | static int input; |
23 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 24 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
24 | 25 | ||
@@ -532,6 +533,39 @@ out_delete_dso: | |||
532 | return -1; | 533 | return -1; |
533 | } | 534 | } |
534 | 535 | ||
536 | static int load_kernel(void) | ||
537 | { | ||
538 | int fd, nr; | ||
539 | |||
540 | if (!vmlinux) | ||
541 | goto kallsyms; | ||
542 | |||
543 | fd = open(vmlinux, O_RDONLY); | ||
544 | if (fd < 0) | ||
545 | goto kallsyms; | ||
546 | |||
547 | kernel_dso = dso__new("[kernel]"); | ||
548 | if (!kernel_dso) | ||
549 | goto fail_open; | ||
550 | |||
551 | nr = dso__load_sym(kernel_dso, fd, vmlinux); | ||
552 | |||
553 | if (nr <= 0) | ||
554 | goto fail_load; | ||
555 | |||
556 | dsos__add(kernel_dso); | ||
557 | close(fd); | ||
558 | |||
559 | return 0; | ||
560 | |||
561 | fail_load: | ||
562 | dso__delete(kernel_dso); | ||
563 | fail_open: | ||
564 | close(fd); | ||
565 | kallsyms: | ||
566 | return load_kallsyms(); | ||
567 | } | ||
568 | |||
535 | struct map { | 569 | struct map { |
536 | struct list_head node; | 570 | struct list_head node; |
537 | uint64_t start; | 571 | uint64_t start; |
@@ -850,7 +884,7 @@ static int __cmd_report(void) | |||
850 | exit(0); | 884 | exit(0); |
851 | } | 885 | } |
852 | 886 | ||
853 | if (load_kallsyms() < 0) { | 887 | if (load_kernel() < 0) { |
854 | perror("failed to open kallsyms"); | 888 | perror("failed to open kallsyms"); |
855 | return EXIT_FAILURE; | 889 | return EXIT_FAILURE; |
856 | } | 890 | } |
@@ -1039,6 +1073,7 @@ static const struct option options[] = { | |||
1039 | "be more verbose (show symbol address, etc)"), | 1073 | "be more verbose (show symbol address, etc)"), |
1040 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1074 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1041 | "dump raw trace in ASCII"), | 1075 | "dump raw trace in ASCII"), |
1076 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), | ||
1042 | OPT_END() | 1077 | OPT_END() |
1043 | }; | 1078 | }; |
1044 | 1079 | ||