Commit 3f931f2c authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf hists: Make hpp setup function generic

Now that we have the 'equal' method implemented for hpp format entries
we can ease up the logic in the following functions and make them
generic wrt comparing format entries:

  perf_hpp__setup_output_field
  perf_hpp__append_sort_keys
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1453109064-1026-8-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c0020efa
...@@ -551,22 +551,12 @@ void perf_hpp__setup_output_field(void) ...@@ -551,22 +551,12 @@ void perf_hpp__setup_output_field(void)
/* append sort keys to output field */ /* append sort keys to output field */
perf_hpp__for_each_sort_list(fmt) { perf_hpp__for_each_sort_list(fmt) {
if (!list_empty(&fmt->list))
continue;
/*
* sort entry fields are dynamically created,
* so they can share a same sort key even though
* the list is empty.
*/
if (perf_hpp__is_sort_entry(fmt)) {
struct perf_hpp_fmt *pos; struct perf_hpp_fmt *pos;
perf_hpp__for_each_format(pos) { perf_hpp__for_each_format(pos) {
if (fmt_equal(fmt, pos)) if (fmt_equal(fmt, pos))
goto next; goto next;
} }
}
perf_hpp__column_register(fmt); perf_hpp__column_register(fmt);
next: next:
...@@ -580,22 +570,12 @@ void perf_hpp__append_sort_keys(void) ...@@ -580,22 +570,12 @@ void perf_hpp__append_sort_keys(void)
/* append output fields to sort keys */ /* append output fields to sort keys */
perf_hpp__for_each_format(fmt) { perf_hpp__for_each_format(fmt) {
if (!list_empty(&fmt->sort_list))
continue;
/*
* sort entry fields are dynamically created,
* so they can share a same sort key even though
* the list is empty.
*/
if (perf_hpp__is_sort_entry(fmt)) {
struct perf_hpp_fmt *pos; struct perf_hpp_fmt *pos;
perf_hpp__for_each_sort_list(pos) { perf_hpp__for_each_sort_list(pos) {
if (fmt_equal(fmt, pos)) if (fmt_equal(fmt, pos))
goto next; goto next;
} }
}
perf_hpp__register_sort_field(fmt); perf_hpp__register_sort_field(fmt);
next: next:
......
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