[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-a7402c943bb4657cc0b44453177803fbead70990@git.kernel.org>
Date: Sat, 17 Feb 2018 03:22:03 -0800
From: tip-bot for Jiri Olsa <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, namhyung@...nel.org,
mingo@...nel.org, jolsa@...nel.org, acme@...hat.com,
alexander.shishkin@...ux.intel.com, tglx@...utronix.de,
hpa@...or.com, peterz@...radead.org, dsahern@...il.com
Subject: [tip:perf/core] perf tools: Fix comment for sort__* compare
functions
Commit-ID: a7402c943bb4657cc0b44453177803fbead70990
Gitweb: https://git.kernel.org/tip/a7402c943bb4657cc0b44453177803fbead70990
Author: Jiri Olsa <jolsa@...nel.org>
AuthorDate: Tue, 6 Feb 2018 19:18:13 +0100
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Fri, 16 Feb 2018 10:09:23 -0300
perf tools: Fix comment for sort__* compare functions
In commit 2f15bd8c6c6e ("perf tools: Fix "Command" sort_entry's cmp and
collapse function") we switched from pointer to string comparison.
But failed to remove related comments. Removing them and adding another
one to warn before pointer comparison in here.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/20180206181813.10943-18-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/sort.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 2da4d04..e8514f6 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -111,17 +111,20 @@ struct sort_entry sort_thread = {
/* --sort comm */
+/*
+ * We can't use pointer comparison in functions below,
+ * because it gives different results based on pointer
+ * values, which could break some sorting assumptions.
+ */
static int64_t
sort__comm_cmp(struct hist_entry *left, struct hist_entry *right)
{
- /* Compare the addr that should be unique among 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 strcmp(comm__str(right->comm), comm__str(left->comm));
}
Powered by blists - more mailing lists