]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf sort: Do not compare dso again
authorNamhyung Kim <namhyung.kim@lge.com>
Wed, 18 Dec 2013 05:21:10 +0000 (14:21 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 18 Dec 2013 17:43:04 +0000 (14:43 -0300)
The commit 09600e0f9ebb ("perf tools: Compare dso's also when comparing
symbols") added a comparison of dso when comparing symbol.

But if the sort key already has dso, it doesn't need to do it again
since entries have a different dso already filtered out.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arun Sharma <asharma@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Rodrigo Campos <rodrigo@sdfg.com.ar>
Link: http://lkml.kernel.org/r/1387344086-12744-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/sort.c

index 68a4fd2f505e65b0b9fbc58e0e1478bdcc1b7e2b..635cd8f8b22ed14463fe4f7fd9357f9e663da41f 100644 (file)
@@ -13,6 +13,7 @@ int           have_ignore_callees = 0;
 int            sort__need_collapse = 0;
 int            sort__has_parent = 0;
 int            sort__has_sym = 0;
+int            sort__has_dso = 0;
 enum sort_mode sort__mode = SORT_MODE__NORMAL;
 
 enum sort_type sort__first_dimension;
@@ -194,9 +195,11 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
         * 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;
+       if (!sort__has_dso) {
+               ret = sort__dso_cmp(left, right);
+               if (ret != 0)
+                       return ret;
+       }
 
        return _sort__sym_cmp(left->ms.sym, right->ms.sym);
 }
@@ -1061,6 +1064,8 @@ int sort_dimension__add(const char *tok)
                        sort__has_parent = 1;
                } else if (sd->entry == &sort_sym) {
                        sort__has_sym = 1;
+               } else if (sd->entry == &sort_dso) {
+                       sort__has_dso = 1;
                }
 
                __sort_dimension__add(sd, i);