[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-450aaa2b2a1b006870ba68251fbb40b2387caade@git.kernel.org>
Date: Wed, 27 May 2009 19:51:31 GMT
From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, jkacur@...hat.com,
a.p.zijlstra@...llo.nl, efault@....de, tglx@...utronix.de,
cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perfcounters/core] perf_counter: tools: report: Add vmlinux support
Commit-ID: 450aaa2b2a1b006870ba68251fbb40b2387caade
Gitweb: http://git.kernel.org/tip/450aaa2b2a1b006870ba68251fbb40b2387caade
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Wed, 27 May 2009 20:20:23 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 27 May 2009 21:44:12 +0200
perf_counter: tools: report: Add vmlinux support
Allow to use vmlinux instead of kallsyms.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: John Kacur <jkacur@...hat.com>
Cc: Mike Galbraith <efault@....de>
LKML-Reference: <20090527182100.740018486@...llo.nl>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
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 a9ff49a..3e87cbd 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -19,6 +19,7 @@
#define SHOW_HV 4
static char const *input_name = "perf.data";
+static char *vmlinux = NULL;
static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@@ -532,6 +533,39 @@ out_delete_dso:
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 list_head node;
uint64_t start;
@@ -850,7 +884,7 @@ static int __cmd_report(void)
exit(0);
}
- if (load_kallsyms() < 0) {
+ if (load_kernel() < 0) {
perror("failed to open kallsyms");
return EXIT_FAILURE;
}
@@ -1039,6 +1073,7 @@ static const struct option options[] = {
"be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
+ OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
OPT_END()
};
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists