Commit 093f0ef3 authored by Namhyung Kim's avatar Namhyung Kim Committed by Jiri Olsa

perf tools: Use hpp formats to sort hist entries

It wrapped sort entries to hpp functions, so using the hpp sort list
to sort entries.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-4-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarJiri Olsa <jolsa@kernel.org>
parent 8b536999
...@@ -432,11 +432,11 @@ struct hist_entry *__hists__add_entry(struct hists *hists, ...@@ -432,11 +432,11 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
int64_t int64_t
hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
{ {
struct sort_entry *se; struct perf_hpp_fmt *fmt;
int64_t cmp = 0; int64_t cmp = 0;
list_for_each_entry(se, &hist_entry__sort_list, list) { perf_hpp__for_each_sort_list(fmt) {
cmp = se->se_cmp(left, right); cmp = fmt->cmp(left, right);
if (cmp) if (cmp)
break; break;
} }
...@@ -447,15 +447,11 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) ...@@ -447,15 +447,11 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
int64_t int64_t
hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
{ {
struct sort_entry *se; struct perf_hpp_fmt *fmt;
int64_t cmp = 0; int64_t cmp = 0;
list_for_each_entry(se, &hist_entry__sort_list, list) { perf_hpp__for_each_sort_list(fmt) {
int64_t (*f)(struct hist_entry *, struct hist_entry *); cmp = fmt->collapse(left, right);
f = se->se_collapse ?: se->se_cmp;
cmp = f(left, right);
if (cmp) if (cmp)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment