diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-05-28 13:55:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-28 17:25:44 -0400 |
commit | a827c875f2ebe69c6e6db5e7f112d4beb4d80f01 (patch) | |
tree | 68ffab0b70688679a239c1e6312ff565784fb0c9 /Documentation/perf_counter/util/symbol.c | |
parent | 0085c954140d27937ada29d139c16341075d45e4 (diff) |
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.c | 17 |
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) | |||
155 | return p - ptr; | 155 | return p - ptr; |
156 | } | 156 | } |
157 | 157 | ||
158 | int dso__load_kallsyms(struct dso *self) | 158 | static int dso__load_kallsyms(struct dso *self) |
159 | { | 159 | { |
160 | struct rb_node *nd, *prevnd; | 160 | struct rb_node *nd, *prevnd; |
161 | char *line = NULL; | 161 | char *line = NULL; |
@@ -410,7 +410,7 @@ out: | |||
410 | return ret; | 410 | return ret; |
411 | } | 411 | } |
412 | 412 | ||
413 | int dso__load_vmlinux(struct dso *self, const char *vmlinux) | 413 | static int dso__load_vmlinux(struct dso *self, const char *vmlinux) |
414 | { | 414 | { |
415 | int err, fd = open(vmlinux, O_RDONLY); | 415 | int err, fd = open(vmlinux, O_RDONLY); |
416 | 416 | ||
@@ -423,6 +423,19 @@ int dso__load_vmlinux(struct dso *self, const char *vmlinux) | |||
423 | return err; | 423 | return err; |
424 | } | 424 | } |
425 | 425 | ||
426 | int dso__load_kernel(struct dso *self, const char *vmlinux) | ||
427 | { | ||
428 | int err = -1; | ||
429 | |||
430 | if (vmlinux) | ||
431 | err = dso__load_vmlinux(self, vmlinux); | ||
432 | |||
433 | if (err) | ||
434 | err = dso__load_kallsyms(self); | ||
435 | |||
436 | return err; | ||
437 | } | ||
438 | |||
426 | void symbol__init(void) | 439 | void symbol__init(void) |
427 | { | 440 | { |
428 | elf_version(EV_CURRENT); | 441 | elf_version(EV_CURRENT); |