diff options
-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 | ||