perf tools: Consolidate output field handling to hpp format routines

Until now the hpp and sort functions do similar jobs different ways.
Since the sort functions converted/wrapped to hpp formats it can do
the job in a uniform way.

The perf_hpp__sort_list has a list of hpp formats to sort entries and
the perf_hpp__list has a list of hpp formats to print output result.

To have a backward compatibility, it automatically adds 'overhead'
field in front of sort list.  And then all of fields in sort list
added to the output list (if it's not already there).

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/n/tip-7g3h86woz2sckg3h1lj42ygj@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
This commit is contained in:
Namhyung Kim
2014-03-03 16:16:20 +09:00
committed by Jiri Olsa
parent 043ca389a3
commit 26d8b33827
6 changed files with 65 additions and 85 deletions

View File

@@ -569,7 +569,7 @@ static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
struct perf_hpp_fmt *fmt;
int64_t cmp = 0;
perf_hpp__for_each_format(fmt) {
perf_hpp__for_each_sort_list(fmt) {
cmp = fmt->sort(a, b);
if (cmp)
break;