aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-05-28 13:55:19 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-28 17:25:44 -0400
commita827c875f2ebe69c6e6db5e7f112d4beb4d80f01 (patch)
tree68ffab0b70688679a239c1e6312ff565784fb0c9 /Documentation/perf_counter/util
parent0085c954140d27937ada29d139c16341075d45e4 (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.c17
-rw-r--r--Documentation/perf_counter/util/symbol.h3
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
158int dso__load_kallsyms(struct dso *self) 158static 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
413int dso__load_vmlinux(struct dso *self, const char *vmlinux) 413static 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
426int 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
426void symbol__init(void) 439void 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
30struct symbol *dso__find_symbol(struct dso *self, uint64_t ip); 30struct symbol *dso__find_symbol(struct dso *self, uint64_t ip);
31 31
32int dso__load_kallsyms(struct dso *self); 32int dso__load_kernel(struct dso *self, const char *vmlinux);
33int dso__load_vmlinux(struct dso *self, const char *vmlinux);
34int dso__load(struct dso *self); 33int dso__load(struct dso *self);
35 34
36size_t dso__fprintf(struct dso *self, FILE *fp); 35size_t dso__fprintf(struct dso *self, FILE *fp);