perf tools: Use hpp formats to sort hist entries
authorNamhyung Kim <namhyung@kernel.org>
Mon, 3 Mar 2014 03:07:47 +0000 (12:07 +0900)
committerJiri Olsa <jolsa@kernel.org>
Wed, 21 May 2014 09:45:34 +0000 (11:45 +0200)
It wrapped sort entries to hpp functions, so using the hpp sort list
to sort entries.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-4-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
tools/perf/util/hist.c

index 7f0236cea4fe5f79c6871bffdf1beb5dcfb52c1c..38373c986e97e4d3ae63889010284dfb636dcd93 100644 (file)
@@ -432,11 +432,11 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 int64_t
 hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
 {
-       struct sort_entry *se;
+       struct perf_hpp_fmt *fmt;
        int64_t cmp = 0;
 
-       list_for_each_entry(se, &hist_entry__sort_list, list) {
-               cmp = se->se_cmp(left, right);
+       perf_hpp__for_each_sort_list(fmt) {
+               cmp = fmt->cmp(left, right);
                if (cmp)
                        break;
        }
@@ -447,15 +447,11 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
 int64_t
 hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
 {
-       struct sort_entry *se;
+       struct perf_hpp_fmt *fmt;
        int64_t cmp = 0;
 
-       list_for_each_entry(se, &hist_entry__sort_list, list) {
-               int64_t (*f)(struct hist_entry *, struct hist_entry *);
-
-               f = se->se_collapse ?: se->se_cmp;
-
-               cmp = f(left, right);
+       perf_hpp__for_each_sort_list(fmt) {
+               cmp = fmt->collapse(left, right);
                if (cmp)
                        break;
        }