Commit 5f0fef8a authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c1529738
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -412,8 +412,8 @@ static u64 find_callsite(struct evsel *evsel, struct perf_sample *sample)
				 sizeof(key), callcmp);
		if (!caller) {
			/* found */
			if (node->map)
				addr = map__unmap_ip(node->map, node->ip);
			if (node->ms.map)
				addr = map__unmap_ip(node->ms.map, node->ip);
			else
				addr = node->ip;

+1 −1
Original line number Diff line number Diff line
@@ -2172,7 +2172,7 @@ static void save_task_callchain(struct perf_sched *sched,
		if (node == NULL)
			break;

		sym = node->sym;
		sym = node->ms.sym;
		if (sym) {
			if (!strcmp(sym->name, "schedule") ||
			    !strcmp(sym->name, "__schedule") ||
+16 −17
Original line number Diff line number Diff line
@@ -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);
}
+2 −3
Original line number Diff line number Diff line
@@ -141,8 +141,7 @@ struct callchain_list {
 */
struct callchain_cursor_node {
	u64				ip;
	struct map			*map;
	struct symbol			*sym;
	struct map_symbol		ms;
	const char			*srcline;
	bool				branch;
	struct branch_flags		branch_flags;
@@ -195,7 +194,7 @@ int callchain_merge(struct callchain_cursor *cursor,
void callchain_cursor_reset(struct callchain_cursor *cursor);

int callchain_cursor_append(struct callchain_cursor *cursor, u64 ip,
			    struct map *map, struct symbol *sym,
			    struct map_symbol *ms,
			    bool branch, struct branch_flags *flags,
			    int nr_loop_iter, u64 iter_cycles, u64 branch_from,
			    const char *srcline);
+2 −2
Original line number Diff line number Diff line
@@ -249,8 +249,8 @@ static struct call_path *call_path_from_sample(struct db_export *dbe,
		 * constructing an addr_location struct and then passing it to
		 * db_ids_from_al() to perform the export.
		 */
		al.sym = node->sym;
		al.map = node->map;
		al.sym = node->ms.sym;
		al.map = node->ms.map;
		al.mg  = thread->mg;
		al.addr = node->ip;

Loading