Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311412

[PATCH 23/26] perf tools: Add struct perf_hpp_list argument to helper functions

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 23/26] perf tools: Add struct perf_hpp_list argument to helper functions
Date 2016-01-18 10:30 +0100
Message-ID <qSein-73y-41@gated-at.bofh.it> (permalink)
References <qSeil-73y-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Link: http://lkml.kernel.org/n/tip-t5g9q42thptl6qaorydp2v16@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/hist.c   | 19 ++++++++++---------
 tools/perf/util/hist.h |  7 ++++---
 tools/perf/util/sort.c |  6 +++---
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 35b28caf4a76..e904ed7b4e8a 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -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);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index c9bd23537c1d..01c321e07cb3 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -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);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 0194dd145401..b4f9841392fa 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -2637,9 +2637,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;
 }
@@ -2655,5 +2655,5 @@ void reset_output_field(void)
 	sort_order = NULL;
 
 	reset_dimensions();
-	perf_hpp__reset_output_field();
+	perf_hpp__reset_output_field(&perf_hpp_list);
 }
-- 
2.4.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 00/26] perf tools: Introduce hists specific format entries Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 14/26] perf tools: Introduce struct perf_hpp_list Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
    Re: [PATCH 14/26] perf tools: Introduce struct perf_hpp_list Namhyung Kim <namhyung@kernel.org> - 2016-01-25 16:10 +0100
      Re: [PATCH 14/26] perf tools: Introduce struct perf_hpp_list Jiri Olsa <jolsa@redhat.com> - 2016-01-25 16:10 +0100
  [PATCH 21/26] perf tools: Introduce perf_hpp_list__for_each_sort_list macro Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 16/26] perf tools: Add perf_hpp_list register helpers Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 17/26] perf tools: Pass perf_hpp_list all the way through setup_sort_list Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 09/26] perf tools: Allocate output sort field Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 13/26] perf tools: Separate output fields parsing into setup_output_list function Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 15/26] perf tools: Introduce perf_hpp_list__init function Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 11/26] perf tools: Properly release format fields Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 07/26] perf tools: Make hpp setup function generic Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 12/26] perf tools: Separate sort fields parsing into setup_sort_list function Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 20/26] perf tools: Introduce perf_hpp_list__for_each_format_safe macro Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 23/26] perf tools: Add struct perf_hpp_list argument to helper functions Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 26/26] perf tools: Introduce hists__for_each_sort_list macro Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 06/26] perf tools: Add hpp__equal callback function Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 22/26] perf tools: Introduce perf_hpp_list__for_each_sort_list_safe macro Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 19/26] perf tools: Introduce perf_hpp_list__for_each_format macro Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 25/26] perf tools: Introduce hists__for_each_format macro Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:30 +0100
  [PATCH 01/26] perf tools: Factor output_resort from hists__output_resort Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:40 +0100
  [PATCH 05/26] perf tools: Add equal method to perf_hpp_fmt struct Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:40 +0100
  [PATCH 03/26] perf tools: Add _idx fields into struct perf_hpp_fmt Jiri Olsa <jolsa@kernel.org> - 2016-01-18 10:40 +0100
  Re: [RFC 00/26] perf tools: Introduce hists specific format entries Namhyung Kim <namhyung@kernel.org> - 2016-01-19 14:00 +0100
    Re: [RFC 00/26] perf tools: Introduce hists specific format entries Jiri Olsa <jolsa@redhat.com> - 2016-01-19 14:30 +0100
  Re: [RFC 00/26] perf tools: Introduce hists specific format entries Jiri Olsa <jolsa@redhat.com> - 2016-01-25 08:20 +0100
    Re: [RFC 00/26] perf tools: Introduce hists specific format entries Namhyung Kim <namhyung@kernel.org> - 2016-01-25 15:30 +0100
      Re: [RFC 00/26] perf tools: Introduce hists specific format entries Jiri Olsa <jolsa@redhat.com> - 2016-01-25 15:40 +0100

csiph-web