diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-03-02 22:07:47 -0500 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-05-21 05:45:34 -0400 |
commit | 093f0ef34c50ff5cca41c1e18e258ff688e915b6 (patch) | |
tree | 36f29aa9e3d2ceb7db7740ce73a87392e608d084 /tools/perf | |
parent | 8b536999cd75e565125c74b2cf2a746d4f053a92 (diff) |
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: 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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/hist.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 7f0236cea4fe..38373c986e97 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -432,11 +432,11 @@ struct hist_entry *__hists__add_entry(struct hists *hists, | |||
432 | int64_t | 432 | int64_t |
433 | hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) | 433 | hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) |
434 | { | 434 | { |
435 | struct sort_entry *se; | 435 | struct perf_hpp_fmt *fmt; |
436 | int64_t cmp = 0; | 436 | int64_t cmp = 0; |
437 | 437 | ||
438 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 438 | perf_hpp__for_each_sort_list(fmt) { |
439 | cmp = se->se_cmp(left, right); | 439 | cmp = fmt->cmp(left, right); |
440 | if (cmp) | 440 | if (cmp) |
441 | break; | 441 | break; |
442 | } | 442 | } |
@@ -447,15 +447,11 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) | |||
447 | int64_t | 447 | int64_t |
448 | hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) | 448 | hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) |
449 | { | 449 | { |
450 | struct sort_entry *se; | 450 | struct perf_hpp_fmt *fmt; |
451 | int64_t cmp = 0; | 451 | int64_t cmp = 0; |
452 | 452 | ||
453 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 453 | perf_hpp__for_each_sort_list(fmt) { |
454 | int64_t (*f)(struct hist_entry *, struct hist_entry *); | 454 | cmp = fmt->collapse(left, right); |
455 | |||
456 | f = se->se_collapse ?: se->se_cmp; | ||
457 | |||
458 | cmp = f(left, right); | ||
459 | if (cmp) | 455 | if (cmp) |
460 | break; | 456 | break; |
461 | } | 457 | } |