Skip to content

Commit 29be60c

Browse files
captain5050namhyung
authored andcommitted
perf build-id: Mark DSO in sample callchains
Previously only the sample IP's map DSO would be marked hit for the purposes of populating the build ID cache. Walk the call chain to mark all IPs and DSOs. Signed-off-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent fccaaf6 commit 29be60c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tools/perf/util/build-id.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,20 @@
4242

4343
static bool no_buildid_cache;
4444

45+
static int mark_dso_hit_callback(struct callchain_cursor_node *node, void *data __maybe_unused)
46+
{
47+
struct map *map = node->ms.map;
48+
49+
if (map)
50+
dso__set_hit(map__dso(map));
51+
52+
return 0;
53+
}
54+
4555
int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused,
4656
union perf_event *event,
4757
struct perf_sample *sample,
48-
struct evsel *evsel __maybe_unused,
58+
struct evsel *evsel,
4959
struct machine *machine)
5060
{
5161
struct addr_location al;
@@ -63,6 +73,11 @@ int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused,
6373
dso__set_hit(map__dso(al.map));
6474

6575
addr_location__exit(&al);
76+
77+
sample__for_each_callchain_node(thread, evsel, sample, PERF_MAX_STACK_DEPTH,
78+
/*symbols=*/false, mark_dso_hit_callback, /*data=*/NULL);
79+
80+
6681
thread__put(thread);
6782
return 0;
6883
}

0 commit comments

Comments
 (0)