diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-10-28 19:51:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-29 03:23:40 -0400 |
commit | 66bd8424cc05e800db384053bf7ab967e4658468 (patch) | |
tree | 2d58312238c78b1fe8482032e019c9437b3564ed /tools/perf/util/map.c | |
parent | 689d30187828afe1faedf050b2f7593515b90c76 (diff) |
perf tools: Delay loading symtabs till we hit a map with it
So that we can have a quicker start on perf top and even
speedups in the other tools, as we can have maps with no hits,
so no need to load its symtabs.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1256773881-4191-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r-- | tools/perf/util/map.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index c1c556825343..d302e513e062 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -21,7 +21,7 @@ static int strcommon(const char *pathname, char *cwd, int cwdlen) | |||
21 | } | 21 | } |
22 | 22 | ||
23 | struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen, | 23 | struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen, |
24 | unsigned int sym_priv_size, symbol_filter_t filter) | 24 | unsigned int sym_priv_size) |
25 | { | 25 | { |
26 | struct map *self = malloc(sizeof(*self)); | 26 | struct map *self = malloc(sizeof(*self)); |
27 | 27 | ||
@@ -29,7 +29,6 @@ struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen, | |||
29 | const char *filename = event->filename; | 29 | const char *filename = event->filename; |
30 | char newfilename[PATH_MAX]; | 30 | char newfilename[PATH_MAX]; |
31 | int anon; | 31 | int anon; |
32 | bool new_dso; | ||
33 | 32 | ||
34 | if (cwd) { | 33 | if (cwd) { |
35 | int n = strcommon(filename, cwd, cwdlen); | 34 | int n = strcommon(filename, cwd, cwdlen); |
@@ -52,23 +51,10 @@ struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen, | |||
52 | self->end = event->start + event->len; | 51 | self->end = event->start + event->len; |
53 | self->pgoff = event->pgoff; | 52 | self->pgoff = event->pgoff; |
54 | 53 | ||
55 | self->dso = dsos__findnew(filename, sym_priv_size, &new_dso); | 54 | self->dso = dsos__findnew(filename, sym_priv_size); |
56 | if (self->dso == NULL) | 55 | if (self->dso == NULL) |
57 | goto out_delete; | 56 | goto out_delete; |
58 | 57 | ||
59 | if (new_dso) { | ||
60 | int nr = dso__load(self->dso, self, filter); | ||
61 | |||
62 | if (nr < 0) | ||
63 | pr_warning("Failed to open %s, continuing " | ||
64 | "without symbols\n", | ||
65 | self->dso->long_name); | ||
66 | else if (nr == 0) | ||
67 | pr_warning("No symbols found in %s, maybe " | ||
68 | "install a debug package?\n", | ||
69 | self->dso->long_name); | ||
70 | } | ||
71 | |||
72 | if (self->dso == vdso || anon) | 58 | if (self->dso == vdso || anon) |
73 | self->map_ip = self->unmap_ip = identity__map_ip; | 59 | self->map_ip = self->unmap_ip = identity__map_ip; |
74 | else { | 60 | else { |
@@ -82,6 +68,26 @@ out_delete: | |||
82 | return NULL; | 68 | return NULL; |
83 | } | 69 | } |
84 | 70 | ||
71 | struct symbol * | ||
72 | map__find_symbol(struct map *self, u64 ip, symbol_filter_t filter) | ||
73 | { | ||
74 | if (!self->dso->loaded) { | ||
75 | int nr = dso__load(self->dso, self, filter); | ||
76 | |||
77 | if (nr < 0) { | ||
78 | pr_warning("Failed to open %s, continuing without symbols\n", | ||
79 | self->dso->long_name); | ||
80 | return NULL; | ||
81 | } else if (nr == 0) { | ||
82 | pr_warning("No symbols found in %s, maybe install a debug package?\n", | ||
83 | self->dso->long_name); | ||
84 | return NULL; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return self->dso->find_symbol(self->dso, ip); | ||
89 | } | ||
90 | |||
85 | struct map *map__clone(struct map *self) | 91 | struct map *map__clone(struct map *self) |
86 | { | 92 | { |
87 | struct map *map = malloc(sizeof(*self)); | 93 | struct map *map = malloc(sizeof(*self)); |