[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-09600e0f9ebb06235b852a646a3644b7d4a71aca@git.kernel.org>
Date: Wed, 23 Oct 2013 00:54:57 -0700
From: tip-bot for Namhyung Kim <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, paulus@...ba.org,
hpa@...or.com, mingo@...nel.org, a.p.zijlstra@...llo.nl,
torvalds@...ux-foundation.org, namhyung.kim@....com,
namhyung@...nel.org, jolsa@...hat.com, dsahern@...il.com,
tglx@...utronix.de
Subject: [tip:perf/core] perf tools: Compare dso'
s also when comparing symbols
Commit-ID: 09600e0f9ebb06235b852a646a3644b7d4a71aca
Gitweb: http://git.kernel.org/tip/09600e0f9ebb06235b852a646a3644b7d4a71aca
Author: Namhyung Kim <namhyung.kim@....com>
AuthorDate: Tue, 15 Oct 2013 11:01:56 +0900
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 21 Oct 2013 17:33:23 -0300
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 <torvalds@...ux-foundation.org>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/r/1381802517-18812-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/sort.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 32c5637..1f9821d 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);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists