diff options
author | 2019-11-04 12:14:32 -0300 | |
---|---|---|
committer | 2019-11-12 08:20:53 -0300 | |
commit | 5f0fef8ac3e7a5707751493293ba8ff2ffc0f8a4 (patch) | |
tree | 5976b7a548550703dcc4b07a6661626a87b74ec3 /tools/perf/util/callchain.c | |
parent | perf unwind: Use 'struct map_symbol' in 'struct unwind_entry' (diff) | |
download | linux-5f0fef8ac3e7a5707751493293ba8ff2ffc0f8a4.tar.gz linux-5f0fef8ac3e7a5707751493293ba8ff2ffc0f8a4.tar.bz2 linux-5f0fef8ac3e7a5707751493293ba8ff2ffc0f8a4.zip |
perf callchain: Use 'struct map_symbol' in 'struct callchain_cursor_node'
To ease passing around map+symbol, just like done for other parts of the
tree recently.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r-- | tools/perf/util/callchain.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 89faa644b0bc..8f89c5a4781f 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -582,8 +582,8 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor) return -1; } call->ip = cursor_node->ip; - call->ms.sym = cursor_node->sym; - call->ms.map = map__get(cursor_node->map); + call->ms = cursor_node->ms; + map__get(call->ms.map); call->srcline = cursor_node->srcline; if (cursor_node->branch) { @@ -720,21 +720,21 @@ static enum match_result match_chain(struct callchain_cursor_node *node, /* otherwise fall-back to symbol-based comparison below */ __fallthrough; case CCKEY_FUNCTION: - if (node->sym && cnode->ms.sym) { + if (node->ms.sym && cnode->ms.sym) { /* * Compare inlined frames based on their symbol name * because different inlined frames will have the same * symbol start. Otherwise do a faster comparison based * on the symbol start address. */ - if (cnode->ms.sym->inlined || node->sym->inlined) { + if (cnode->ms.sym->inlined || node->ms.sym->inlined) { match = match_chain_strings(cnode->ms.sym->name, - node->sym->name); + node->ms.sym->name); if (match != MATCH_ERROR) break; } else { match = match_chain_dso_addresses(cnode->ms.map, cnode->ms.sym->start, - node->map, node->sym->start); + node->ms.map, node->ms.sym->start); break; } } @@ -742,7 +742,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node, __fallthrough; case CCKEY_ADDRESS: default: - match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->map, node->ip); + match = match_chain_dso_addresses(cnode->ms.map, cnode->ip, node->ms.map, node->ip); break; } @@ -1004,8 +1004,7 @@ merge_chain_branch(struct callchain_cursor *cursor, int err = 0; list_for_each_entry_safe(list, next_list, &src->val, list) { - callchain_cursor_append(cursor, list->ip, - list->ms.map, list->ms.sym, + callchain_cursor_append(cursor, list->ip, &list->ms, false, NULL, 0, 0, 0, list->srcline); list_del_init(&list->list); map__zput(list->ms.map); @@ -1044,7 +1043,7 @@ int callchain_merge(struct callchain_cursor *cursor, } int callchain_cursor_append(struct callchain_cursor *cursor, - u64 ip, struct map *map, struct symbol *sym, + u64 ip, struct map_symbol *ms, bool branch, struct branch_flags *flags, int nr_loop_iter, u64 iter_cycles, u64 branch_from, const char *srcline) @@ -1060,9 +1059,9 @@ int callchain_cursor_append(struct callchain_cursor *cursor, } node->ip = ip; - map__zput(node->map); - node->map = map__get(map); - node->sym = sym; + map__zput(node->ms.map); + node->ms = *ms; + map__get(node->ms.map); node->branch = branch; node->nr_loop_iter = nr_loop_iter; node->iter_cycles = iter_cycles; @@ -1107,8 +1106,8 @@ int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *samp int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node, bool hide_unresolved) { - al->map = node->map; - al->sym = node->sym; + al->map = node->ms.map; + al->sym = node->ms.sym; al->srcline = node->srcline; al->addr = node->ip; @@ -1571,7 +1570,7 @@ int callchain_cursor__copy(struct callchain_cursor *dst, if (node == NULL) break; - rc = callchain_cursor_append(dst, node->ip, node->map, node->sym, + rc = callchain_cursor_append(dst, node->ip, &node->ms, node->branch, &node->branch_flags, node->nr_loop_iter, node->iter_cycles, @@ -1597,5 +1596,5 @@ void callchain_cursor_reset(struct callchain_cursor *cursor) cursor->last = &cursor->first; for (node = cursor->first; node != NULL; node = node->next) - map__zput(node->map); + map__zput(node->ms.map); } |