perf tools: A thread's machine can be found via thread->mg->machine
So stop passing both machine and thread to several thread methods, reducing function signature length. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -1289,7 +1289,7 @@ static bool symbol__match_regex(struct symbol *sym, regex_t *regex)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ip__resolve_ams(struct machine *machine, struct thread *thread,
|
||||
static void ip__resolve_ams(struct thread *thread,
|
||||
struct addr_map_symbol *ams,
|
||||
u64 ip)
|
||||
{
|
||||
@@ -1303,7 +1303,7 @@ static void ip__resolve_ams(struct machine *machine, struct thread *thread,
|
||||
* Thus, we have to try consecutively until we find a match
|
||||
* or else, the symbol is unknown
|
||||
*/
|
||||
thread__find_cpumode_addr_location(thread, machine, MAP__FUNCTION, ip, &al);
|
||||
thread__find_cpumode_addr_location(thread, MAP__FUNCTION, ip, &al);
|
||||
|
||||
ams->addr = ip;
|
||||
ams->al_addr = al.addr;
|
||||
@@ -1311,23 +1311,21 @@ static void ip__resolve_ams(struct machine *machine, struct thread *thread,
|
||||
ams->map = al.map;
|
||||
}
|
||||
|
||||
static void ip__resolve_data(struct machine *machine, struct thread *thread,
|
||||
static void ip__resolve_data(struct thread *thread,
|
||||
u8 m, struct addr_map_symbol *ams, u64 addr)
|
||||
{
|
||||
struct addr_location al;
|
||||
|
||||
memset(&al, 0, sizeof(al));
|
||||
|
||||
thread__find_addr_location(thread, machine, m, MAP__VARIABLE, addr,
|
||||
&al);
|
||||
thread__find_addr_location(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, machine, m, MAP__FUNCTION, addr,
|
||||
&al);
|
||||
thread__find_addr_location(thread, m, MAP__FUNCTION, addr, &al);
|
||||
}
|
||||
|
||||
ams->addr = addr;
|
||||
@@ -1344,9 +1342,8 @@ struct mem_info *sample__resolve_mem(struct perf_sample *sample,
|
||||
if (!mi)
|
||||
return NULL;
|
||||
|
||||
ip__resolve_ams(al->machine, al->thread, &mi->iaddr, sample->ip);
|
||||
ip__resolve_data(al->machine, al->thread, al->cpumode,
|
||||
&mi->daddr, sample->addr);
|
||||
ip__resolve_ams(al->thread, &mi->iaddr, sample->ip);
|
||||
ip__resolve_data(al->thread, al->cpumode, &mi->daddr, sample->addr);
|
||||
mi->data_src.val = sample->data_src;
|
||||
|
||||
return mi;
|
||||
@@ -1363,15 +1360,14 @@ struct branch_info *sample__resolve_bstack(struct perf_sample *sample,
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < bs->nr; i++) {
|
||||
ip__resolve_ams(al->machine, al->thread, &bi[i].to, bs->entries[i].to);
|
||||
ip__resolve_ams(al->machine, al->thread, &bi[i].from, bs->entries[i].from);
|
||||
ip__resolve_ams(al->thread, &bi[i].to, bs->entries[i].to);
|
||||
ip__resolve_ams(al->thread, &bi[i].from, bs->entries[i].from);
|
||||
bi[i].flags = bs->entries[i].flags;
|
||||
}
|
||||
return bi;
|
||||
}
|
||||
|
||||
static int machine__resolve_callchain_sample(struct machine *machine,
|
||||
struct thread *thread,
|
||||
static int thread__resolve_callchain_sample(struct thread *thread,
|
||||
struct ip_callchain *chain,
|
||||
struct symbol **parent,
|
||||
struct addr_location *root_al,
|
||||
@@ -1395,7 +1391,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
|
||||
* Based on DWARF debug information, some architectures skip
|
||||
* a callchain entry saved by the kernel.
|
||||
*/
|
||||
skip_idx = arch_skip_callchain_idx(machine, thread, chain);
|
||||
skip_idx = arch_skip_callchain_idx(thread, chain);
|
||||
|
||||
for (i = 0; i < chain_nr; i++) {
|
||||
u64 ip;
|
||||
@@ -1437,7 +1433,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
|
||||
}
|
||||
|
||||
al.filtered = 0;
|
||||
thread__find_addr_location(thread, machine, cpumode,
|
||||
thread__find_addr_location(thread, cpumode,
|
||||
MAP__FUNCTION, ip, &al);
|
||||
if (al.sym != NULL) {
|
||||
if (sort__has_parent && !*parent &&
|
||||
@@ -1476,11 +1472,8 @@ int machine__resolve_callchain(struct machine *machine,
|
||||
struct addr_location *root_al,
|
||||
int max_stack)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = machine__resolve_callchain_sample(machine, thread,
|
||||
sample->callchain, parent,
|
||||
root_al, max_stack);
|
||||
int ret = thread__resolve_callchain_sample(thread, sample->callchain,
|
||||
parent, root_al, max_stack);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
Reference in New Issue
Block a user