summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorJiri Olsa2015-05-15 17:54:28 +0200
committerArnaldo Carvalho de Melo2015-05-15 22:02:21 +0200
commit2f15bd8c6c6e80f15c899ea84b53fa607a2f08b2 (patch)
tree43d894077cc5e1eb460ce24d528a1c36e9795d57 /tools/perf/util
parentperf tools: Fix dwarf-aux.c compilation on i386 (diff)
downloadkernel-qcow2-linux-2f15bd8c6c6e80f15c899ea84b53fa607a2f08b2.tar.gz
kernel-qcow2-linux-2f15bd8c6c6e80f15c899ea84b53fa607a2f08b2.tar.xz
kernel-qcow2-linux-2f15bd8c6c6e80f15c899ea84b53fa607a2f08b2.zip
perf tools: Fix "Command" sort_entry's cmp and collapse function
Currently the se_cmp and se_collapse use pointer comparison, which is ok for for testing equality of strings. It's not ok as comparing function for rbtree insertion, because it gives different results based on current pointer values. We saw test 32 (hists cumulation test) failing based on different environment setup. Having all sort functions straightened fix the test for us. Reported-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Jan Stancek <jstancek@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/sort.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 4593f36ecc4c..09d4696fd9a1 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -89,14 +89,14 @@ static int64_t
sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
{
/* Compare the addr that should be unique among comm */
- return comm__str(right->comm) - comm__str(left->comm);
+ return strcmp(comm__str(right->comm), comm__str(left->comm));
}
static int64_t
sort__comm_collapse(struct hist_entry *left, struct hist_entry *right)
{
/* Compare the addr that should be unique among comm */
- return comm__str(right->comm) - comm__str(left->comm);
+ return strcmp(comm__str(right->comm), comm__str(left->comm));
}
static int64_t