[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180109153522.14116-24-jolsa@kernel.org>
Date: Tue, 9 Jan 2018 16:34:56 +0100
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
David Ahern <dsahern@...il.com>,
Andi Kleen <ak@...ux.intel.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [PATCH 23/49] perf callchain: Use thread__find_addr_location_by_time() and friends
From: Namhyung Kim <namhyung@...nel.org>
Find correct thread/map/symbol using proper functions.
Cc: Frederic Weisbecker <fweisbec@...il.com>
Link: http://lkml.kernel.org/n/tip-k02mlrexo1h3bsezgrr7ydn8@git.kernel.org
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/util/machine.c | 22 +++++++++++++---------
tools/perf/util/unwind-libdw.c | 12 +++++++-----
tools/perf/util/unwind-libunwind-local.c | 16 ++++++++--------
3 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index b6fbb302b4e0..26f4fc719601 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1950,7 +1950,8 @@ static int add_callchain_ip(struct thread *thread,
bool branch,
struct branch_flags *flags,
struct iterations *iter,
- u64 branch_from)
+ u64 branch_from,
+ u64 timestamp)
{
struct addr_location al;
int nr_loop_iter = 0;
@@ -1960,8 +1961,9 @@ static int add_callchain_ip(struct thread *thread,
al.filtered = 0;
al.sym = NULL;
if (!cpumode) {
- thread__find_cpumode_addr_location(thread, MAP__FUNCTION,
- ip, &al);
+ thread__find_cpumode_addr_location_by_time(thread,
+ MAP__FUNCTION, ip,
+ &al, timestamp);
} else {
if (ip >= PERF_CONTEXT_MAX) {
switch (ip) {
@@ -1986,8 +1988,9 @@ static int add_callchain_ip(struct thread *thread,
}
return 0;
}
- thread__find_addr_location(thread, *cpumode, MAP__FUNCTION,
- ip, &al);
+ thread__find_addr_location_by_time(thread, *cpumode,
+ MAP__FUNCTION, ip,
+ &al, timestamp);
}
if (al.sym != NULL) {
@@ -2184,7 +2187,7 @@ static int resolve_lbr_callchain_sample(struct thread *thread,
err = add_callchain_ip(thread, cursor, parent,
root_al, &cpumode, ip,
branch, flags, NULL,
- branch_from);
+ branch_from, sample->time);
if (err)
return (err < 0) ? err : 0;
}
@@ -2207,6 +2210,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
int chain_nr = 0;
u8 cpumode = PERF_RECORD_MISC_USER;
int i, j, err, nr_entries;
+ u64 timestamp = sample->time;
int skip_idx = -1;
int first_call = 0;
@@ -2280,13 +2284,13 @@ static int thread__resolve_callchain_sample(struct thread *thread,
root_al,
NULL, be[i].to,
true, &be[i].flags,
- NULL, be[i].from);
+ NULL, be[i].from, timestamp);
if (!err)
err = add_callchain_ip(thread, cursor, parent, root_al,
NULL, be[i].from,
true, &be[i].flags,
- &iter[i], 0);
+ &iter[i], 0, timestamp);
if (err == -EINVAL)
break;
if (err)
@@ -2320,7 +2324,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
err = add_callchain_ip(thread, cursor, parent,
root_al, &cpumode, ip,
- false, NULL, NULL, 0);
+ false, NULL, NULL, 0, timestamp);
if (err)
return (err < 0) ? err : 0;
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index 1e9c974faf67..188c388453a7 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -29,9 +29,9 @@ 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);
+ thread__find_addr_location_by_time(ui->thread, PERF_RECORD_MISC_USER,
+ MAP__FUNCTION, ip, al,
+ ui->sample->time);
if (al->map)
dso = al->map->dso;
@@ -103,8 +103,10 @@ static int access_dso_mem(struct unwind_info *ui, Dwarf_Addr addr,
struct addr_location al;
ssize_t size;
- thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
- MAP__FUNCTION, addr, &al);
+ thread__find_addr_map_by_time(ui->thread, PERF_RECORD_MISC_USER,
+ MAP__FUNCTION, addr, &al,
+ ui->sample->time);
+
if (!al.map) {
/*
* We've seen cases (softice) where DWARF unwinder went
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 7a42f703e858..2b00de870185 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -367,16 +367,16 @@ static struct map *find_map(unw_word_t ip, struct unwind_info *ui)
{
struct addr_location al;
- thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
- MAP__FUNCTION, ip, &al);
+ thread__find_addr_map_by_time(ui->thread, PERF_RECORD_MISC_USER,
+ MAP__FUNCTION, ip, &al, ui->sample->time);
if (!al.map) {
/*
* We've seen cases (softice) where DWARF unwinder went
* through non executable mmaps, which we need to lookup
* in MAP__VARIABLE tree.
*/
- thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER,
- MAP__VARIABLE, ip, &al);
+ thread__find_addr_map_by_time(ui->thread, PERF_RECORD_MISC_USER,
+ MAP__VARIABLE, ip, &al, ui->sample->time);
}
return al.map;
}
@@ -580,14 +580,14 @@ static void put_unwind_info(unw_addr_space_t __maybe_unused as,
pr_debug("unwind: put_unwind_info called\n");
}
-static int entry(u64 ip, struct thread *thread,
+static int entry(u64 ip, struct thread *thread, u64 timestamp,
unwind_entry_cb_t cb, void *arg)
{
struct unwind_entry e;
struct addr_location al;
- thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
- MAP__FUNCTION, ip, &al);
+ thread__find_addr_location_by_time(thread, PERF_RECORD_MISC_USER,
+ MAP__FUNCTION, ip, &al, timestamp);
e.ip = al.addr;
e.map = al.map;
@@ -718,7 +718,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
if (callchain_param.order == ORDER_CALLER)
j = max_stack - i - 1;
- ret = ips[j] ? entry(ips[j], ui->thread, cb, arg) : 0;
+ ret = ips[j] ? entry(ips[j], ui->thread, ui->sample->time, cb, arg) : 0;
}
return ret;
--
2.13.6
Powered by blists - more mailing lists