summaryrefslogtreecommitdiff
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-04-24 11:58:56 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-04-26 13:47:08 -0300
commit71a84b5aedf5023f4009c3bbf28ecba256201f87 (patch)
tree966cfe5ebed091694f0e8981fa0f4a9d9769d839 /tools/perf/util/event.c
parentcc5f02f2be8d3354986bad5703ee8a983872f140 (diff)
perf thread: Make thread__find_map() return the map
It was returning the searched map just on the addr_location passed, with the function itself returning void. Make it return the map so that we can make the code more compact. 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-tzlrrzdeoof4i6ktyqv1t6ks@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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2d860fbeb227..48e4b252f6ff 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1489,8 +1489,8 @@ int perf_event__process(struct perf_tool *tool __maybe_unused,
return machine__process_event(machine, event, sample);
}
-void __thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
- u64 addr, struct addr_location *al)
+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;
@@ -1504,7 +1504,7 @@ void __thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
if (machine == NULL) {
al->map = NULL;
- return;
+ return NULL;
}
if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
@@ -1532,7 +1532,7 @@ void __thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
!perf_host)
al->filtered |= (1 << HIST_FILTER__HOST);
- return;
+ return NULL;
}
try_again:
al->map = map_groups__find(mg, type, al->addr);
@@ -1562,14 +1562,15 @@ try_again:
map__load(al->map);
al->addr = al->map->map_ip(al->map, al->addr);
}
+
+ return al->map;
}
void __thread__find_symbol(struct thread *thread, u8 cpumode,
enum map_type type, u64 addr,
struct addr_location *al)
{
- __thread__find_map(thread, cpumode, type, addr, al);
- if (al->map != NULL)
+ if (__thread__find_map(thread, cpumode, type, addr, al))
al->sym = map__find_symbol(al->map, al->addr);
else
al->sym = NULL;
@@ -1668,8 +1669,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)
{
- thread__find_map(thread, sample->cpumode, sample->addr, al);
- if (!al->map) {
+ if (!thread__find_map(thread, sample->cpumode, sample->addr, al)) {
__thread__find_map(thread, sample->cpumode, MAP__VARIABLE,
sample->addr, al);
}