提交 450aaa2b 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

perf_counter: tools: report: Add vmlinux support

Allow to use vmlinux instead of kallsyms.
Signed-off-by: NPeter 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: NIngo Molnar <mingo@elte.hu>
上级 b7a16eac
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define SHOW_HV 4 #define SHOW_HV 4
static char const *input_name = "perf.data"; static char const *input_name = "perf.data";
static char *vmlinux = NULL;
static int input; static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
...@@ -532,6 +533,39 @@ static int load_kallsyms(void) ...@@ -532,6 +533,39 @@ static int load_kallsyms(void)
return -1; return -1;
} }
static int load_kernel(void)
{
int fd, nr;
if (!vmlinux)
goto kallsyms;
fd = open(vmlinux, O_RDONLY);
if (fd < 0)
goto kallsyms;
kernel_dso = dso__new("[kernel]");
if (!kernel_dso)
goto fail_open;
nr = dso__load_sym(kernel_dso, fd, vmlinux);
if (nr <= 0)
goto fail_load;
dsos__add(kernel_dso);
close(fd);
return 0;
fail_load:
dso__delete(kernel_dso);
fail_open:
close(fd);
kallsyms:
return load_kallsyms();
}
struct map { struct map {
struct list_head node; struct list_head node;
uint64_t start; uint64_t start;
...@@ -850,7 +884,7 @@ static int __cmd_report(void) ...@@ -850,7 +884,7 @@ static int __cmd_report(void)
exit(0); exit(0);
} }
if (load_kallsyms() < 0) { if (load_kernel() < 0) {
perror("failed to open kallsyms"); perror("failed to open kallsyms");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
...@@ -1039,6 +1073,7 @@ static const struct option options[] = { ...@@ -1039,6 +1073,7 @@ static const struct option options[] = {
"be more verbose (show symbol address, etc)"), "be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"), "dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
OPT_END() OPT_END()
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册