diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-09-14 14:54:30 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-09-23 13:37:54 -0400 |
| commit | af52aafad26fe83edc3ff95d6f630c2fc98a0c4c (patch) | |
| tree | ad71a13f3fa386c50fc1b0f3b50b20a0b3ce4b0e | |
| parent | be96ea8ffa788dccb1ba895cced29db6687c4911 (diff) | |
perf top: Fix userspace sample addr map offset
The 'perf top' tool came from the kernel where we had each DSO (vmlinux,
modules) loaded just once at a time.
But userspace may have DSOs loaded in multiple addresses (shared
libraries), requiring that we use the just resolved map instead of the
first one found.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ag53wz0yllpgers0n2w7hchp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/perf/builtin-top.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a43433f08300..d28013b7d61c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
| @@ -191,7 +191,8 @@ static void __zero_source_counters(struct sym_entry *syme) | |||
| 191 | symbol__annotate_zero_histograms(sym); | 191 | symbol__annotate_zero_histograms(sym); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static void record_precise_ip(struct sym_entry *syme, int counter, u64 ip) | 194 | static void record_precise_ip(struct sym_entry *syme, struct map *map, |
| 195 | int counter, u64 ip) | ||
| 195 | { | 196 | { |
| 196 | struct annotation *notes; | 197 | struct annotation *notes; |
| 197 | struct symbol *sym; | 198 | struct symbol *sym; |
| @@ -205,8 +206,8 @@ static void record_precise_ip(struct sym_entry *syme, int counter, u64 ip) | |||
| 205 | if (pthread_mutex_trylock(¬es->lock)) | 206 | if (pthread_mutex_trylock(¬es->lock)) |
| 206 | return; | 207 | return; |
| 207 | 208 | ||
| 208 | ip = syme->map->map_ip(syme->map, ip); | 209 | ip = map->map_ip(map, ip); |
| 209 | symbol__inc_addr_samples(sym, syme->map, counter, ip); | 210 | symbol__inc_addr_samples(sym, map, counter, ip); |
| 210 | 211 | ||
| 211 | pthread_mutex_unlock(¬es->lock); | 212 | pthread_mutex_unlock(¬es->lock); |
| 212 | } | 213 | } |
| @@ -810,7 +811,7 @@ static void perf_event__process_sample(const union perf_event *event, | |||
| 810 | evsel = perf_evlist__id2evsel(top.evlist, sample->id); | 811 | evsel = perf_evlist__id2evsel(top.evlist, sample->id); |
| 811 | assert(evsel != NULL); | 812 | assert(evsel != NULL); |
| 812 | syme->count[evsel->idx]++; | 813 | syme->count[evsel->idx]++; |
| 813 | record_precise_ip(syme, evsel->idx, ip); | 814 | record_precise_ip(syme, al.map, evsel->idx, ip); |
| 814 | pthread_mutex_lock(&top.active_symbols_lock); | 815 | pthread_mutex_lock(&top.active_symbols_lock); |
| 815 | if (list_empty(&syme->node) || !syme->node.next) { | 816 | if (list_empty(&syme->node) || !syme->node.next) { |
| 816 | static bool first = true; | 817 | static bool first = true; |
