path: root/tools
diff options
authorArnaldo Carvalho de Melo <>2011-09-14 15:54:30 -0300
committerArnaldo Carvalho de Melo <>2011-09-23 14:37:54 -0300
commitaf52aafad26fe83edc3ff95d6f630c2fc98a0c4c (patch)
treead71a13f3fa386c50fc1b0f3b50b20a0b3ce4b0e /tools
parentbe96ea8ffa788dccb1ba895cced29db6687c4911 (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 <> Cc: Frederic Weisbecker <> Cc: Mike Galbraith <> Cc: Paul Mackerras <> Cc: Peter Zijlstra <> Cc: Stephane Eranian <> Link: Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools')
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)
-static void record_precise_ip(struct sym_entry *syme, int counter, u64 ip)
+static void record_precise_ip(struct sym_entry *syme, struct map *map,
+ int counter, u64 ip)
struct annotation *notes;
struct symbol *sym;
@@ -205,8 +206,8 @@ static void record_precise_ip(struct sym_entry *syme, int counter, u64 ip)
if (pthread_mutex_trylock(&notes->lock))
- ip = syme->map->map_ip(syme->map, ip);
- symbol__inc_addr_samples(sym, syme->map, counter, ip);
+ ip = map->map_ip(map, ip);
+ symbol__inc_addr_samples(sym, map, counter, ip);
@@ -810,7 +811,7 @@ static void perf_event__process_sample(const union perf_event *event,
evsel = perf_evlist__id2evsel(top.evlist, sample->id);
assert(evsel != NULL);
- record_precise_ip(syme, evsel->idx, ip);
+ record_precise_ip(syme,, evsel->idx, ip);
if (list_empty(&syme->node) || !syme-> {
static bool first = true;