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 | |
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')
-rw-r--r-- | Documentation/perf_counter/util/symbol.c | 17 | ||||
-rw-r--r-- | Documentation/perf_counter/util/symbol.h | 3 |
2 files changed, 16 insertions, 4 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); |
diff --git a/Documentation/perf_counter/util/symbol.h b/Documentation/perf_counter/util/symbol.h index 9e120af9c71f..db2fdf9f70a2 100644 --- a/Documentation/perf_counter/util/symbol.h +++ b/Documentation/perf_counter/util/symbol.h | |||
@@ -29,8 +29,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) | |||
29 | 29 | ||
30 | struct symbol *dso__find_symbol(struct dso *self, uint64_t ip); | 30 | struct symbol *dso__find_symbol(struct dso *self, uint64_t ip); |
31 | 31 | ||
32 | int dso__load_kallsyms(struct dso *self); | 32 | int dso__load_kernel(struct dso *self, const char *vmlinux); |
33 | int dso__load_vmlinux(struct dso *self, const char *vmlinux); | ||
34 | int dso__load(struct dso *self); | 33 | int dso__load(struct dso *self); |
35 | 34 | ||
36 | size_t dso__fprintf(struct dso *self, FILE *fp); | 35 | size_t dso__fprintf(struct dso *self, FILE *fp); |