aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2018-04-24 11:24:49 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-04-26 13:47:07 -0300
commit4546263d72e22ea84b49dafad26d8ca679d5e83d (patch)
treefa9d0ee378ceaf87c5cdc5d10f978f1dd0072e8e /tools/perf/util
parentperf tests: Let 'perf test list' display subtests (diff)
downloadlinux-dev-4546263d72e22ea84b49dafad26d8ca679d5e83d.tar.xz
linux-dev-4546263d72e22ea84b49dafad26d8ca679d5e83d.zip
perf thread: Introduce thread__find_symbol()
Out of thread__find_addr_location(..., MAP__FUNCTION, ...), idea here is to continue removing references to MAP__{FUNCTION,VARIABLE} ahead of getting both types of symbols in the same rbtree, as various places do two lookups, looking first at MAP__FUNCTION, then at MAP__VARIABLE. So thread__find_symbol() will eventually do just that, and 'struct symbol' will have the symbol type, for code that cares about that. 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-n7528en9e08yd3flzmb26tth@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/event.c6
-rw-r--r--tools/perf/util/machine.c7
-rw-r--r--tools/perf/util/thread.c2
-rw-r--r--tools/perf/util/thread.h11
-rw-r--r--tools/perf/util/unwind-libdw.c9
-rw-r--r--tools/perf/util/unwind-libunwind-local.c3
6 files changed, 21 insertions, 17 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index baa97d0b6114..2d860fbeb227 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1564,9 +1564,9 @@ try_again:
}
}
-void thread__find_addr_location(struct thread *thread,
- u8 cpumode, enum map_type type, u64 addr,
- struct addr_location *al)
+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)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 32d50492505d..e354d94a68e8 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1681,14 +1681,14 @@ static void ip__resolve_data(struct thread *thread,
memset(&al, 0, sizeof(al));
- thread__find_addr_location(thread, m, MAP__VARIABLE, addr, &al);
+ __thread__find_symbol(thread, m, MAP__VARIABLE, addr, &al);
if (al.map == NULL) {
/*
* some shared data regions have execute bit set which puts
* their mapping in the MAP__FUNCTION type array.
* Check there as a fallback option before dropping the sample.
*/
- thread__find_addr_location(thread, m, MAP__FUNCTION, addr, &al);
+ thread__find_symbol(thread, m, addr, &al);
}
ams->addr = addr;
@@ -1784,8 +1784,7 @@ static int add_callchain_ip(struct thread *thread,
}
return 0;
}
- thread__find_addr_location(thread, *cpumode, MAP__FUNCTION,
- ip, &al);
+ thread__find_symbol(thread, *cpumode, ip, &al);
}
if (al.sym != NULL) {
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 68b65b10579b..2a3fb7c6b39d 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -384,7 +384,7 @@ void thread__find_cpumode_addr_location(struct thread *thread,
};
for (i = 0; i < ARRAY_SIZE(cpumodes); i++) {
- thread__find_addr_location(thread, cpumodes[i], type, addr, al);
+ __thread__find_symbol(thread, cpumodes[i], type, addr, al);
if (al->map)
break;
}
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 52c788f955de..b69e65c821f9 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -101,9 +101,14 @@ static inline void thread__find_map(struct thread *thread, u8 cpumode,
__thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al);
}
-void thread__find_addr_location(struct thread *thread,
- u8 cpumode, enum map_type type, u64 addr,
- struct addr_location *al);
+void __thread__find_symbol(struct thread *thread, u8 cpumode, enum map_type type,
+ u64 addr, struct addr_location *al);
+
+static inline void thread__find_symbol(struct thread *thread, u8 cpumode,
+ u64 addr, struct addr_location *al)
+{
+ return __thread__find_symbol(thread, cpumode, MAP__FUNCTION, addr, al);
+}
void thread__find_cpumode_addr_location(struct thread *thread,
enum map_type type, u64 addr,
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index 1ce8744649b5..bdc22f1864df 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -28,10 +28,11 @@ static int __report_module(struct addr_location *al, u64 ip,
{
Dwfl_Module *mod;
struct dso *dso = NULL;
-
- thread__find_addr_location(ui->thread,
- PERF_RECORD_MISC_USER,
- MAP__FUNCTION, ip, al);
+ /*
+ * Some callers will use al->sym, so we can't just use the
+ * cheaper thread__find_map() here.
+ */
+ thread__find_symbol(ui->thread, PERF_RECORD_MISC_USER, ip, al);
if (al->map)
dso = al->map->dso;
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 33afca5c04f6..0007c64f3220 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -585,8 +585,7 @@ static int entry(u64 ip, struct thread *thread,
struct unwind_entry e;
struct addr_location al;
- thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
- MAP__FUNCTION, ip, &al);
+ thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al);
e.ip = al.addr;
e.map = al.map;