path: root/tools/perf
diff options
authorNamhyung Kim <>2013-10-15 11:01:56 +0900
committerArnaldo Carvalho de Melo <>2013-10-21 17:33:23 -0300
commit09600e0f9ebb06235b852a646a3644b7d4a71aca (patch)
treeb2114a8553bc1b48bc3c1ce314711f150c396d7b /tools/perf
parente369517ce5f796945c6af047b4e8b1d650e03458 (diff)
perf tools: Compare dso's also when comparing symbols
Linus reported that sometimes 'perf report -s symbol' exits without any message on TUI. David and Jiri found that it's because it failed to add a hist entry due to an invalid symbol length. It turns out that sorting by symbol (address) was broken since it only compares symbol addresses. The symbol address is a relative address within a dso thus just checking its address can result in merging unrelated symbols together. Fix it by checking dso before comparing symbol address. Reported-by: Linus Torvalds <> Signed-off-by: Namhyung Kim <> Cc: David Ahern <> Cc: Ingo Molnar <> Cc: Jiri Olsa <> Cc: Paul Mackerras <> Cc: Peter Zijlstra <> Link: Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools/perf')
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 32c56377e008..1f9821db9e77 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -182,9 +182,19 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
static int64_t
sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
+ int64_t ret;
if (!left->ms.sym && !right->ms.sym)
return right->level - left->level;
+ /*
+ * comparing symbol address alone is not enough since it's a
+ * relative address within a dso.
+ */
+ ret = sort__dso_cmp(left, right);
+ if (ret != 0)
+ return ret;
return _sort__sym_cmp(left->ms.sym, right->ms.sym);