[RFC/PATCH 2/2] perf tools: Sort dso using pointers

From: Namhyung Kim
Date: Mon Oct 14 2013 - 22:02:17 EST


From: Namhyung Kim <namhyung.kim@xxxxxxx>

The dso's in a perf session are maintained machine-wide so same dso is
shared by hist entries. Thus just checking pointer should be enough
to comparing dso's.

It may change behavior of 'perf report -s dso' when there're two or
more dso's that have same basename - the dso's which have same name
used to merged to one unless -v option was given. But I don't think
it's a big problem. ;)

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/sort.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 1f9821db9e77..70658a0834e3 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -114,20 +114,8 @@ static int64_t _sort__dso_cmp(struct map *map_l, struct map *map_r)
{
struct dso *dso_l = map_l ? map_l->dso : NULL;
struct dso *dso_r = map_r ? map_r->dso : NULL;
- const char *dso_name_l, *dso_name_r;

- if (!dso_l || !dso_r)
- return cmp_null(dso_l, dso_r);
-
- if (verbose) {
- dso_name_l = dso_l->long_name;
- dso_name_r = dso_r->long_name;
- } else {
- dso_name_l = dso_l->short_name;
- dso_name_r = dso_r->short_name;
- }
-
- return strcmp(dso_name_l, dso_name_r);
+ return (int64_t)(dso_l - dso_r);
}

static int64_t
--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/