perf hists: Add struct perf_hpp_list argument to helper functions
authorJiri Olsa <jolsa@kernel.org>
Mon, 18 Jan 2016 09:24:21 +0000 (10:24 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 3 Feb 2016 15:24:17 +0000 (12:24 -0300)
Adding struct perf_hpp_list argument to following helper functions:

  void perf_hpp__setup_output_field(struct perf_hpp_list *list);
  void perf_hpp__reset_output_field(struct perf_hpp_list *list);
  void perf_hpp__append_sort_keys(struct perf_hpp_list *list);

so they could be used on hists's hpp_list.

Signed-off-by: Jiri 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-24-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/ui/hist.c
tools/perf/util/hist.h
tools/perf/util/sort.c

index 9cda51edfdbd6c2b628410cdc2b164651b192b07..8075d4cc54a812131c58c1339b24b7fd9407c2cd 100644 (file)
@@ -548,15 +548,15 @@ static bool fmt_equal(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b)
        return a->equal && a->equal(a, b);
 }
 
-void perf_hpp__setup_output_field(void)
+void perf_hpp__setup_output_field(struct perf_hpp_list *list)
 {
        struct perf_hpp_fmt *fmt;
 
        /* append sort keys to output field */
-       perf_hpp_list__for_each_sort_list(&perf_hpp_list, fmt) {
+       perf_hpp_list__for_each_sort_list(list, fmt) {
                struct perf_hpp_fmt *pos;
 
-               perf_hpp_list__for_each_format(&perf_hpp_list, pos) {
+               perf_hpp_list__for_each_format(list, pos) {
                        if (fmt_equal(fmt, pos))
                                goto next;
                }
@@ -567,15 +567,15 @@ next:
        }
 }
 
-void perf_hpp__append_sort_keys(void)
+void perf_hpp__append_sort_keys(struct perf_hpp_list *list)
 {
        struct perf_hpp_fmt *fmt;
 
        /* append output fields to sort keys */
-       perf_hpp_list__for_each_format(&perf_hpp_list, fmt) {
+       perf_hpp_list__for_each_format(list, fmt) {
                struct perf_hpp_fmt *pos;
 
-               perf_hpp_list__for_each_sort_list(&perf_hpp_list, pos) {
+               perf_hpp_list__for_each_sort_list(list, pos) {
                        if (fmt_equal(fmt, pos))
                                goto next;
                }
@@ -586,25 +586,26 @@ next:
        }
 }
 
+
 static void fmt_free(struct perf_hpp_fmt *fmt)
 {
        if (fmt->free)
                fmt->free(fmt);
 }
 
-void perf_hpp__reset_output_field(void)
+void perf_hpp__reset_output_field(struct perf_hpp_list *list)
 {
        struct perf_hpp_fmt *fmt, *tmp;
 
        /* reset output fields */
-       perf_hpp_list__for_each_format_safe(&perf_hpp_list, fmt, tmp) {
+       perf_hpp_list__for_each_format_safe(list, fmt, tmp) {
                list_del_init(&fmt->list);
                list_del_init(&fmt->sort_list);
                fmt_free(fmt);
        }
 
        /* reset sort keys */
-       perf_hpp_list__for_each_sort_list_safe(&perf_hpp_list, fmt, tmp) {
+       perf_hpp_list__for_each_sort_list_safe(list, fmt, tmp) {
                list_del_init(&fmt->list);
                list_del_init(&fmt->sort_list);
                fmt_free(fmt);
index 61d35a9f928b100e8e76482fee90befd930ea3d6..a39c9c1159ff07cddb7fcec3a3a8dd1e25205154 100644 (file)
@@ -279,9 +279,10 @@ enum {
 void perf_hpp__init(void);
 void perf_hpp__column_unregister(struct perf_hpp_fmt *format);
 void perf_hpp__cancel_cumulate(void);
-void perf_hpp__setup_output_field(void);
-void perf_hpp__reset_output_field(void);
-void perf_hpp__append_sort_keys(void);
+void perf_hpp__setup_output_field(struct perf_hpp_list *list);
+void perf_hpp__reset_output_field(struct perf_hpp_list *list);
+void perf_hpp__append_sort_keys(struct perf_hpp_list *list);
+
 
 bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
 bool perf_hpp__is_dynamic_entry(struct perf_hpp_fmt *format);
index 1e134ff56ad4da6bfa6ae7965b7dba0a53a234ea..de620f7f40f4ad01e30e4385865efd1c3797022a 100644 (file)
@@ -2636,9 +2636,9 @@ int setup_sorting(struct perf_evlist *evlist)
                return err;
 
        /* copy sort keys to output fields */
-       perf_hpp__setup_output_field();
+       perf_hpp__setup_output_field(&perf_hpp_list);
        /* and then copy output fields to sort keys */
-       perf_hpp__append_sort_keys();
+       perf_hpp__append_sort_keys(&perf_hpp_list);
 
        return 0;
 }
@@ -2654,5 +2654,5 @@ void reset_output_field(void)
        sort_order = NULL;
 
        reset_dimensions();
-       perf_hpp__reset_output_field();
+       perf_hpp__reset_output_field(&perf_hpp_list);
 }