summaryrefslogtreecommitdiff
path: root/Documentation/perf_counter/util/symbol.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-05-28 14:55:19 -0300
committerIngo Molnar <mingo@elte.hu>2009-05-28 23:25:44 +0200
commita827c875f2ebe69c6e6db5e7f112d4beb4d80f01 (patch)
tree68ffab0b70688679a239c1e6312ff565784fb0c9 /Documentation/perf_counter/util/symbol.c
parent0085c954140d27937ada29d139c16341075d45e4 (diff)
downloadlwn-a827c875f2ebe69c6e6db5e7f112d4beb4d80f01.tar.gz
lwn-a827c875f2ebe69c6e6db5e7f112d4beb4d80f01.zip
perf_counter tools: Consolidate dso methods to load kernel symbols
Now one has just to use dso__load_kernel() optionally passing a vmlinux filename. Will make things easier for perf top that will want to pass a callback to filter some symbols. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/util/symbol.c')
-rw-r--r--Documentation/perf_counter/util/symbol.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c
index 7088206244ac..504ac3132019 100644
--- a/Documentation/perf_counter/util/symbol.c
+++ b/Documentation/perf_counter/util/symbol.c
@@ -155,7 +155,7 @@ static int hex2long(char *ptr, unsigned long *long_val)
return p - ptr;
}
-int dso__load_kallsyms(struct dso *self)
+static int dso__load_kallsyms(struct dso *self)
{
struct rb_node *nd, *prevnd;
char *line = NULL;
@@ -410,7 +410,7 @@ out:
return ret;
}
-int dso__load_vmlinux(struct dso *self, const char *vmlinux)
+static int dso__load_vmlinux(struct dso *self, const char *vmlinux)
{
int err, fd = open(vmlinux, O_RDONLY);
@@ -423,6 +423,19 @@ int dso__load_vmlinux(struct dso *self, const char *vmlinux)
return err;
}
+int dso__load_kernel(struct dso *self, const char *vmlinux)
+{
+ int err = -1;
+
+ if (vmlinux)
+ err = dso__load_vmlinux(self, vmlinux);
+
+ if (err)
+ err = dso__load_kallsyms(self);
+
+ return err;
+}
+
void symbol__init(void)
{
elf_version(EV_CURRENT);