Skip to contentSkip to conversation

perf hists: Make hist_entry__has_callchains() work with 'perf c2c'

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jun 14, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  e5654455795f2f89328f7b301dacb6926e57e2b8
Gitweb:     https://git.kernel.org/tip/e5654455795f2f89328f7b301dacb6926e57e2b8
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 7 Jun 2018 14:27:19 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 7 Jun 2018 14:27:19 -0300

perf hists: Make hist_entry__has_callchains() work with 'perf c2c'

Since 'perf c2c' uses 'struct hists' not allocated together with a 'struct perf_evsel' instance, we can't go from a 'struct hist_entry' pointer to a 'struct perf_evsel' via he->hists, so, instead, check if space was set aside for hist_entry->callchain[0] at hist_entry__new() time.

Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Fixes fabd37b837f6 ("perf hists: Check if a hist_entry has callchains before using them")
---
 tools/perf/util/sort.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/sort.h +1 -1
index 9ab9257ed887..8bf302cafcec 100644
@@ -155,7 +155,7 @@ struct hist_entry {
 
 static __pure inline bool hist_entry__has_callchains(struct hist_entry *he)
 {
-	return hists__has_callchains(he->hists);
+	return he->callchain_size != 0;
 }
 
 static inline bool hist_entry__has_pairs(struct hist_entry *he)