perf tools: Update cpumode for each cumulative entry
The cpumode and level in struct addr_localtion was set for a sample and but updated as cumulative callchains were added. This led to have non-matching symbol and cpumode in the output. Update it accordingly based on the fact whether the map is a part of the kernel or not. This is a reverse of what thread__find_addr_map() does. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arun Sharma <asharma@fb.com> Tested-by: Rodrigo Campos <rodrigo@sdfg.com.ar> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/r/1401335910-16832-7-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
This commit is contained in:
@@ -630,3 +630,45 @@ int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *samp
|
||||
return 0;
|
||||
return callchain_append(he->callchain, &callchain_cursor, sample->period);
|
||||
}
|
||||
|
||||
int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node,
|
||||
bool hide_unresolved)
|
||||
{
|
||||
al->map = node->map;
|
||||
al->sym = node->sym;
|
||||
if (node->map)
|
||||
al->addr = node->map->map_ip(node->map, node->ip);
|
||||
else
|
||||
al->addr = node->ip;
|
||||
|
||||
if (al->sym == NULL) {
|
||||
if (hide_unresolved)
|
||||
return 0;
|
||||
if (al->map == NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (al->map->groups == &al->machine->kmaps) {
|
||||
if (machine__is_host(al->machine)) {
|
||||
al->cpumode = PERF_RECORD_MISC_KERNEL;
|
||||
al->level = 'k';
|
||||
} else {
|
||||
al->cpumode = PERF_RECORD_MISC_GUEST_KERNEL;
|
||||
al->level = 'g';
|
||||
}
|
||||
} else {
|
||||
if (machine__is_host(al->machine)) {
|
||||
al->cpumode = PERF_RECORD_MISC_USER;
|
||||
al->level = '.';
|
||||
} else if (perf_guest) {
|
||||
al->cpumode = PERF_RECORD_MISC_GUEST_USER;
|
||||
al->level = 'u';
|
||||
} else {
|
||||
al->cpumode = PERF_RECORD_MISC_HYPERVISOR;
|
||||
al->level = 'H';
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user