summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-04-26 09:34:37 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-04-26 13:47:17 -0300
commit404eb5a436c4cbdc3b76896a28a3b72b7ad9294e (patch)
tree58fda90bb9a25d8318c1ed51b2521ee4f0366583 /tools/perf/util/event.c
parent117d3c2474a24ab842af00972598c25abffee1e6 (diff)
downloadlinux-404eb5a436c4cbdc3b76896a28a3b72b7ad9294e.tar.bz2
perf thread: Make thread__find_map() search all maps
We still have the split internally, but users don't see it anymore, simplifying the growing number of cases where we end up searching in the MAP__VARIABLE maps. This further paves the way for ditching the split. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-86mfxrztf310konutxvhr5ua@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 7b67771cd478..7831c2266118 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1488,8 +1488,8 @@ int perf_event__process(struct perf_tool *tool __maybe_unused,
return machine__process_event(machine, event, sample);
}
-struct map *__thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
- u64 addr, struct addr_location *al)
+static struct map *__thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
+ u64 addr, struct addr_location *al)
{
struct map_groups *mg = thread->mg;
struct machine *machine = mg->machine;
@@ -1565,12 +1565,18 @@ try_again:
return al->map;
}
+struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
+ struct addr_location *al)
+{
+ struct map *map = __thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al);
+ return map ?: __thread__find_map(thread, cpumode, MAP__VARIABLE, addr, al);
+}
+
struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
u64 addr, struct addr_location *al)
{
al->sym = NULL;
- if (__thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al) ||
- __thread__find_map(thread, cpumode, MAP__VARIABLE, addr, al))
+ if (thread__find_map(thread, cpumode, addr, al))
al->sym = map__find_symbol(al->map, al->addr);
return al->sym;
}
@@ -1668,10 +1674,7 @@ bool sample_addr_correlates_sym(struct perf_event_attr *attr)
void thread__resolve(struct thread *thread, struct addr_location *al,
struct perf_sample *sample)
{
- if (!thread__find_map(thread, sample->cpumode, sample->addr, al)) {
- __thread__find_map(thread, sample->cpumode, MAP__VARIABLE,
- sample->addr, al);
- }
+ thread__find_map(thread, sample->cpumode, sample->addr, al);
al->cpu = sample->cpu;
al->sym = NULL;