linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list
@ 2016-05-03 11:54 Jiri Olsa
  2016-05-03 11:54 ` [PATCH 1/7] perf tools: Move sort__need_collapse " Jiri Olsa
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

hi,
now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Also available in here:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/fixes

thanks,
jirka


---
Jiri Olsa (7):
      perf tools: Move sort__need_collapse into struct perf_hpp_list
      perf tools: Move sort__has_parent into struct perf_hpp_list
      perf tools: Move sort__has_sym into struct perf_hpp_list
      perf tools: Move sort__has_dso into struct perf_hpp_list
      perf tools: Move sort__has_socket into struct perf_hpp_list
      perf tools: Move sort__has_thread into struct perf_hpp_list
      perf tools: Move sort__has_comm into struct perf_hpp_list

 tools/perf/builtin-diff.c         |  4 ++--
 tools/perf/builtin-report.c       |  4 ++--
 tools/perf/builtin-top.c          |  8 ++++----
 tools/perf/tests/hists_common.c   |  2 +-
 tools/perf/tests/hists_cumulate.c |  2 +-
 tools/perf/tests/hists_link.c     |  4 ++--
 tools/perf/tests/hists_output.c   |  2 +-
 tools/perf/ui/browsers/hists.c    | 32 +++++++++++++++++---------------
 tools/perf/ui/gtk/hists.c         |  2 +-
 tools/perf/ui/hist.c              |  2 +-
 tools/perf/util/annotate.c        |  2 +-
 tools/perf/util/callchain.c       |  2 +-
 tools/perf/util/hist.c            | 14 +++++++-------
 tools/perf/util/hist.h            | 10 ++++++++++
 tools/perf/util/machine.c         |  2 +-
 tools/perf/util/sort.c            | 35 ++++++++++++++---------------------
 tools/perf/util/sort.h            |  7 -------
 17 files changed, 66 insertions(+), 68 deletions(-)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] perf tools: Move sort__need_collapse into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:42   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  2016-05-03 11:54 ` [PATCH 2/7] perf tools: Move sort__has_parent " Jiri Olsa
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__need_collapse into struct perf_hpp_list.

Adding hists__has macro to easily access this info
perf struct hists object.

Link: http://lkml.kernel.org/n/tip-3ozhiim0djl58eoa52k3z6js@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-diff.c         |  4 ++--
 tools/perf/builtin-report.c       |  2 +-
 tools/perf/builtin-top.c          |  2 +-
 tools/perf/tests/hists_common.c   |  2 +-
 tools/perf/tests/hists_cumulate.c |  2 +-
 tools/perf/tests/hists_link.c     |  4 ++--
 tools/perf/tests/hists_output.c   |  2 +-
 tools/perf/util/hist.c            | 14 +++++++-------
 tools/perf/util/hist.h            |  4 ++++
 tools/perf/util/sort.c            |  5 ++---
 tools/perf/util/sort.h            |  1 -
 11 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 8053a8ceefda..9ce354f469dc 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -428,7 +428,7 @@ static void hists__baseline_only(struct hists *hists)
 	struct rb_root *root;
 	struct rb_node *next;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -450,7 +450,7 @@ static void hists__precompute(struct hists *hists)
 	struct rb_root *root;
 	struct rb_node *next;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8d9b88af901d..394d05ec0014 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -936,7 +936,7 @@ repeat:
 			goto error;
 		}
 
-		sort__need_collapse = true;
+		perf_hpp_list.need_collapse = true;
 	}
 
 	/* Force tty output for header output and per-thread stat. */
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index da18517b1d40..ff6109839cdd 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1255,7 +1255,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	sort__mode = SORT_MODE__TOP;
 	/* display thread wants entries to be collapsed in a different tree */
-	sort__need_collapse = 1;
+	perf_hpp_list.need_collapse = 1;
 
 	if (top.use_stdio)
 		use_browser = 0;
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index f55f4bd47932..6b21746d6eec 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -161,7 +161,7 @@ void print_hists_in(struct hists *hists)
 	struct rb_root *root;
 	struct rb_node *node;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index 4a2bbff9b1ee..a9e3db3afac4 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -126,7 +126,7 @@ static void del_hist_entries(struct hists *hists)
 	struct rb_root *root_out;
 	struct rb_node *node;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root_in = &hists->entries_collapsed;
 	else
 		root_in = hists->entries_in;
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 358324e47805..acf5a1301c07 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -145,7 +145,7 @@ static int __validate_match(struct hists *hists)
 	/*
 	 * Only entries from fake_common_samples should have a pair.
 	 */
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -197,7 +197,7 @@ static int __validate_link(struct hists *hists, int idx)
 	 * and some entries will have no pair.  However every entry
 	 * in other hists should have (dummy) pair.
 	 */
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index 7cd8738e842f..63c5efaba1b5 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -92,7 +92,7 @@ static void del_hist_entries(struct hists *hists)
 	struct rb_root *root_out;
 	struct rb_node *node;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root_in = &hists->entries_collapsed;
 	else
 		root_in = hists->entries_in;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 0f33d7e698c4..cfab531437c7 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -295,7 +295,7 @@ static void hists__delete_entry(struct hists *hists, struct hist_entry *he)
 		root_in  = &he->parent_he->hroot_in;
 		root_out = &he->parent_he->hroot_out;
 	} else {
-		if (sort__need_collapse)
+		if (hists__has(hists, need_collapse))
 			root_in = &hists->entries_collapsed;
 		else
 			root_in = hists->entries_in;
@@ -1373,7 +1373,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
 	struct hist_entry *n;
 	int ret;
 
-	if (!sort__need_collapse)
+	if (!hists__has(hists, need_collapse))
 		return 0;
 
 	hists->nr_entries = 0;
@@ -1632,7 +1632,7 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
 		return;
 	}
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -2036,7 +2036,7 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
 	struct hist_entry *he;
 	int64_t cmp;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -2078,7 +2078,7 @@ static struct hist_entry *hists__find_entry(struct hists *hists,
 {
 	struct rb_node *n;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		n = hists->entries_collapsed.rb_node;
 	else
 		n = hists->entries_in->rb_node;
@@ -2107,7 +2107,7 @@ void hists__match(struct hists *leader, struct hists *other)
 	struct rb_node *nd;
 	struct hist_entry *pos, *pair;
 
-	if (sort__need_collapse)
+	if (hists__has(leader, need_collapse))
 		root = &leader->entries_collapsed;
 	else
 		root = leader->entries_in;
@@ -2132,7 +2132,7 @@ int hists__link(struct hists *leader, struct hists *other)
 	struct rb_node *nd;
 	struct hist_entry *pos, *pair;
 
-	if (sort__need_collapse)
+	if (hists__has(other, need_collapse))
 		root = &other->entries_collapsed;
 	else
 		root = other->entries_in;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 588596561cb3..ec76e6bef916 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -82,6 +82,8 @@ struct hists {
 	int			nr_hpp_node;
 };
 
+#define hists__has(__h, __f) (__h)->hpp_list->__f
+
 struct hist_entry_iter;
 
 struct hist_iter_ops {
@@ -238,6 +240,8 @@ struct perf_hpp_fmt {
 struct perf_hpp_list {
 	struct list_head fields;
 	struct list_head sorts;
+
+	int need_collapse;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 47966a1618c7..64ace548dc88 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__need_collapse = 0;
 int		sort__has_parent = 0;
 int		sort__has_sym = 0;
 int		sort__has_dso = 0;
@@ -2163,7 +2162,7 @@ static int __sort_dimension__add(struct sort_dimension *sd,
 		return -1;
 
 	if (sd->entry->se_collapse)
-		sort__need_collapse = 1;
+		list->need_collapse = 1;
 
 	sd->taken = 1;
 
@@ -2746,7 +2745,7 @@ int setup_sorting(struct perf_evlist *evlist)
 
 void reset_output_field(void)
 {
-	sort__need_collapse = 0;
+	perf_hpp_list.need_collapse = 0;
 	sort__has_parent = 0;
 	sort__has_sym = 0;
 	sort__has_dso = 0;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 3f4e35998119..2e1d27326954 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__need_collapse;
 extern int sort__has_dso;
 extern int sort__has_parent;
 extern int sort__has_sym;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/7] perf tools: Move sort__has_parent into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
  2016-05-03 11:54 ` [PATCH 1/7] perf tools: Move sort__need_collapse " Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:42   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  2016-05-03 11:54 ` [PATCH 3/7] perf tools: Move sort__has_sym " Jiri Olsa
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_parent into struct perf_hpp_list.

Link: http://lkml.kernel.org/n/tip-ff54d6bc3zi5pvn1l5cfl67m@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-report.c | 2 +-
 tools/perf/util/callchain.c | 2 +-
 tools/perf/util/hist.h      | 1 +
 tools/perf/util/machine.c   | 2 +-
 tools/perf/util/sort.c      | 5 ++---
 tools/perf/util/sort.h      | 1 -
 6 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 394d05ec0014..87d40e3c4078 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -234,7 +234,7 @@ static int report__setup_sample_type(struct report *rep)
 		sample_type |= PERF_SAMPLE_BRANCH_STACK;
 
 	if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
-		if (sort__has_parent) {
+		if (perf_hpp_list.parent) {
 			ui__error("Selected --sort parent, but no "
 				    "callchain data. Did you call "
 				    "'perf record' without -g?\n");
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index aa248dcb4440..07fd30bc2f81 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -799,7 +799,7 @@ int sample__resolve_callchain(struct perf_sample *sample,
 		return 0;
 
 	if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain ||
-	    sort__has_parent) {
+	    perf_hpp_list.parent) {
 		return thread__resolve_callchain(al->thread, cursor, evsel, sample,
 						 parent, al, max_stack);
 	}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index ec76e6bef916..57b09791c339 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -242,6 +242,7 @@ struct perf_hpp_list {
 	struct list_head sorts;
 
 	int need_collapse;
+	int parent;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 2cb95bbf9ea6..0d28025c746e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1647,7 +1647,7 @@ static int add_callchain_ip(struct thread *thread,
 	}
 
 	if (al.sym != NULL) {
-		if (sort__has_parent && !*parent &&
+		if (perf_hpp_list.parent && !*parent &&
 		    symbol__match_regex(al.sym, &parent_regex))
 			*parent = al.sym;
 		else if (have_ignore_callees && root_al &&
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 64ace548dc88..75b33d387f50 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_parent = 0;
 int		sort__has_sym = 0;
 int		sort__has_dso = 0;
 int		sort__has_socket = 0;
@@ -2244,7 +2243,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 				pr_err("Invalid regex: %s\n%s", parent_pattern, err);
 				return -EINVAL;
 			}
-			sort__has_parent = 1;
+			list->parent = 1;
 		} else if (sd->entry == &sort_sym) {
 			sort__has_sym = 1;
 			/*
@@ -2746,7 +2745,7 @@ int setup_sorting(struct perf_evlist *evlist)
 void reset_output_field(void)
 {
 	perf_hpp_list.need_collapse = 0;
-	sort__has_parent = 0;
+	perf_hpp_list.parent = 0;
 	sort__has_sym = 0;
 	sort__has_dso = 0;
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 2e1d27326954..0e44aea86800 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -32,7 +32,6 @@ extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
 extern int sort__has_dso;
-extern int sort__has_parent;
 extern int sort__has_sym;
 extern int sort__has_socket;
 extern int sort__has_thread;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/7] perf tools: Move sort__has_sym into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
  2016-05-03 11:54 ` [PATCH 1/7] perf tools: Move sort__need_collapse " Jiri Olsa
  2016-05-03 11:54 ` [PATCH 2/7] perf tools: Move sort__has_parent " Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:42   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  2016-05-03 11:54 ` [PATCH 4/7] perf tools: Move sort__has_dso " Jiri Olsa
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_sym into struct perf_hpp_list.

Link: http://lkml.kernel.org/n/tip-8fu1m7l9r9inrmbgz5nmownv@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-top.c       | 4 ++--
 tools/perf/ui/browsers/hists.c | 6 +++---
 tools/perf/ui/gtk/hists.c      | 2 +-
 tools/perf/ui/hist.c           | 2 +-
 tools/perf/util/annotate.c     | 2 +-
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 9 ++++-----
 tools/perf/util/sort.h         | 1 -
 8 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ff6109839cdd..39fe06fc19d3 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -688,7 +688,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
 	struct hist_entry *he = iter->he;
 	struct perf_evsel *evsel = iter->evsel;
 
-	if (sort__has_sym && single)
+	if (perf_hpp_list.sym && single)
 		perf_top__record_precise_ip(top, he, evsel->idx, al->addr);
 
 	hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
@@ -919,7 +919,7 @@ out_err:
 
 static int callchain_param__setup_sample_type(struct callchain_param *callchain)
 {
-	if (!sort__has_sym) {
+	if (!perf_hpp_list.sym) {
 		if (callchain->enabled) {
 			ui__error("Selected -g but \"sym\" not present in --sort/-s.");
 			return -EINVAL;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6a4681932ba5..b66bf83ed883 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2747,7 +2747,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 			 */
 			goto out_free_stack;
 		case 'a':
-			if (!sort__has_sym) {
+			if (!hists__has(hists, sym)) {
 				ui_browser__warning(&browser->b, delay_secs * 2,
 			"Annotation is only available for symbolic views, "
 			"include \"sym*\" in --sort to use it.");
@@ -2910,7 +2910,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 			continue;
 		}
 
-		if (!sort__has_sym || browser->selection == NULL)
+		if (!hists__has(hists, sym) || browser->selection == NULL)
 			goto skip_annotation;
 
 		if (sort__mode == SORT_MODE__BRANCH) {
@@ -2969,7 +2969,7 @@ skip_annotation:
 			 *
 			 * See hist_browser__show_entry.
 			 */
-			if (sort__has_sym && browser->selection->sym) {
+			if (hists__has(hists, sym) && browser->selection->sym) {
 				nr_options += add_script_opt(browser,
 							     &actions[nr_options],
 							     &options[nr_options],
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 2aa45b606fa4..932adfaa05af 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -379,7 +379,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
 			gtk_tree_store_set(store, &iter, col_idx++, s, -1);
 		}
 
-		if (symbol_conf.use_callchain && sort__has_sym) {
+		if (symbol_conf.use_callchain && hists__has(hists, sym)) {
 			if (callchain_param.mode == CHAIN_GRAPH_REL)
 				total = symbol_conf.cumulate_callchain ?
 					h->stat_acc->period : h->stat.period;
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 3baeaa6e71b5..af07ffb129ca 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -635,7 +635,7 @@ unsigned int hists__sort_list_width(struct hists *hists)
 		ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
 	}
 
-	if (verbose && sort__has_sym) /* Addr + origin */
+	if (verbose && hists__has(hists, sym)) /* Addr + origin */
 		ret += 3 + BITS_PER_LONG / 4;
 
 	return ret;
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index b795b6994144..d4b3d034c503 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1665,5 +1665,5 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize)
 
 bool ui__has_annotation(void)
 {
-	return use_browser == 1 && sort__has_sym;
+	return use_browser == 1 && perf_hpp_list.sym;
 }
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 57b09791c339..c3a77502e22b 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -243,6 +243,7 @@ struct perf_hpp_list {
 
 	int need_collapse;
 	int parent;
+	int sym;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 75b33d387f50..544ab376ac42 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_sym = 0;
 int		sort__has_dso = 0;
 int		sort__has_socket = 0;
 int		sort__has_thread = 0;
@@ -2245,7 +2244,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 			}
 			list->parent = 1;
 		} else if (sd->entry == &sort_sym) {
-			sort__has_sym = 1;
+			list->sym = 1;
 			/*
 			 * perf diff displays the performance difference amongst
 			 * two or more perf.data files. Those files could come
@@ -2287,7 +2286,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 			return -EINVAL;
 
 		if (sd->entry == &sort_sym_from || sd->entry == &sort_sym_to)
-			sort__has_sym = 1;
+			list->sym = 1;
 
 		__sort_dimension__add(sd, list, level);
 		return 0;
@@ -2303,7 +2302,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 			return -EINVAL;
 
 		if (sd->entry == &sort_mem_daddr_sym)
-			sort__has_sym = 1;
+			list->sym = 1;
 
 		__sort_dimension__add(sd, list, level);
 		return 0;
@@ -2746,7 +2745,7 @@ void reset_output_field(void)
 {
 	perf_hpp_list.need_collapse = 0;
 	perf_hpp_list.parent = 0;
-	sort__has_sym = 0;
+	perf_hpp_list.sym = 0;
 	sort__has_dso = 0;
 
 	field_order = NULL;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 0e44aea86800..9a5e7d4a2cac 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -32,7 +32,6 @@ extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
 extern int sort__has_dso;
-extern int sort__has_sym;
 extern int sort__has_socket;
 extern int sort__has_thread;
 extern int sort__has_comm;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] perf tools: Move sort__has_dso into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
                   ` (2 preceding siblings ...)
  2016-05-03 11:54 ` [PATCH 3/7] perf tools: Move sort__has_sym " Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:43   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  2016-05-03 11:54 ` [PATCH 5/7] perf tools: Move sort__has_socket " Jiri Olsa
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_dso into struct perf_hpp_list.

Link: http://lkml.kernel.org/n/tip-8wcj3m487je58r8ss227zpne@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 8 ++++----
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 7 +++----
 tools/perf/util/sort.h         | 1 -
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b66bf83ed883..6b2f95300e35 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2380,7 +2380,7 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
 {
 	struct map *map = act->ms.map;
 
-	if (!sort__has_dso || map == NULL)
+	if (!hists__has(browser->hists, dso) || map == NULL)
 		return 0;
 
 	if (browser->hists->dso_filter) {
@@ -2407,7 +2407,7 @@ static int
 add_dso_opt(struct hist_browser *browser, struct popup_action *act,
 	    char **optstr, struct map *map)
 {
-	if (!sort__has_dso || map == NULL)
+	if (!hists__has(browser->hists, dso) || map == NULL)
 		return 0;
 
 	if (asprintf(optstr, "Zoom %s %s DSO",
@@ -2429,10 +2429,10 @@ do_browse_map(struct hist_browser *browser __maybe_unused,
 }
 
 static int
-add_map_opt(struct hist_browser *browser __maybe_unused,
+add_map_opt(struct hist_browser *browser,
 	    struct popup_action *act, char **optstr, struct map *map)
 {
-	if (!sort__has_dso || map == NULL)
+	if (!hists__has(browser->hists, dso) || map == NULL)
 		return 0;
 
 	if (asprintf(optstr, "Browse map details") < 0)
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index c3a77502e22b..4302f34f36ae 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -244,6 +244,7 @@ struct perf_hpp_list {
 	int need_collapse;
 	int parent;
 	int sym;
+	int dso;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 544ab376ac42..2446c39b5fa6 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_dso = 0;
 int		sort__has_socket = 0;
 int		sort__has_thread = 0;
 int		sort__has_comm = 0;
@@ -241,7 +240,7 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
 	 * comparing symbol address alone is not enough since it's a
 	 * relative address within a dso.
 	 */
-	if (!sort__has_dso) {
+	if (!hists__has(left->hists, dso) || hists__has(right->hists, dso)) {
 		ret = sort__dso_cmp(left, right);
 		if (ret != 0)
 			return ret;
@@ -2255,7 +2254,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 				sd->entry->se_collapse = sort__sym_sort;
 
 		} else if (sd->entry == &sort_dso) {
-			sort__has_dso = 1;
+			list->dso = 1;
 		} else if (sd->entry == &sort_socket) {
 			sort__has_socket = 1;
 		} else if (sd->entry == &sort_thread) {
@@ -2746,7 +2745,7 @@ void reset_output_field(void)
 	perf_hpp_list.need_collapse = 0;
 	perf_hpp_list.parent = 0;
 	perf_hpp_list.sym = 0;
-	sort__has_dso = 0;
+	perf_hpp_list.dso = 0;
 
 	field_order = NULL;
 	sort_order = NULL;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 9a5e7d4a2cac..87d4addf92b5 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_dso;
 extern int sort__has_socket;
 extern int sort__has_thread;
 extern int sort__has_comm;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/7] perf tools: Move sort__has_socket into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
                   ` (3 preceding siblings ...)
  2016-05-03 11:54 ` [PATCH 4/7] perf tools: Move sort__has_dso " Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:43   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  2016-05-03 11:54 ` [PATCH 6/7] perf tools: Move sort__has_thread " Jiri Olsa
  2016-05-03 11:54 ` [PATCH 7/7] perf tools: Move sort__has_comm " Jiri Olsa
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_socket into struct perf_hpp_list.

Link: http://lkml.kernel.org/n/tip-xw5og4xb7strqfxte5yj8swd@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-top.c       | 2 +-
 tools/perf/ui/browsers/hists.c | 4 ++--
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 3 +--
 tools/perf/util/sort.h         | 1 -
 5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 39fe06fc19d3..1793da585676 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -962,7 +962,7 @@ static int __cmd_top(struct perf_top *top)
 	machine__synthesize_threads(&top->session->machines.host, &opts->target,
 				    top->evlist->threads, false, opts->proc_map_timeout);
 
-	if (sort__has_socket) {
+	if (perf_hpp_list.socket) {
 		ret = perf_env__read_cpu_topology_map(&perf_env);
 		if (ret < 0)
 			goto out_err_cpu_topo;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6b2f95300e35..b25bf82c121f 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2534,7 +2534,7 @@ add_exit_opt(struct hist_browser *browser __maybe_unused,
 static int
 do_zoom_socket(struct hist_browser *browser, struct popup_action *act)
 {
-	if (!sort__has_socket || act->socket < 0)
+	if (!hists__has(browser->hists, socket) || act->socket < 0)
 		return 0;
 
 	if (browser->hists->socket_filter > -1) {
@@ -2556,7 +2556,7 @@ static int
 add_socket_opt(struct hist_browser *browser, struct popup_action *act,
 	       char **optstr, int socket_id)
 {
-	if (!sort__has_socket || socket_id < 0)
+	if (!hists__has(browser->hists, socket) || socket_id < 0)
 		return 0;
 
 	if (asprintf(optstr, "Zoom %s Processor Socket %d",
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 4302f34f36ae..66f313936faf 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -245,6 +245,7 @@ struct perf_hpp_list {
 	int parent;
 	int sym;
 	int dso;
+	int socket;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 2446c39b5fa6..712a71ad76a6 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_socket = 0;
 int		sort__has_thread = 0;
 int		sort__has_comm = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
@@ -2256,7 +2255,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		} else if (sd->entry == &sort_dso) {
 			list->dso = 1;
 		} else if (sd->entry == &sort_socket) {
-			sort__has_socket = 1;
+			list->socket = 1;
 		} else if (sd->entry == &sort_thread) {
 			sort__has_thread = 1;
 		} else if (sd->entry == &sort_comm) {
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 87d4addf92b5..85424a608074 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_socket;
 extern int sort__has_thread;
 extern int sort__has_comm;
 extern enum sort_mode sort__mode;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 6/7] perf tools: Move sort__has_thread into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
                   ` (4 preceding siblings ...)
  2016-05-03 11:54 ` [PATCH 5/7] perf tools: Move sort__has_socket " Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:44   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  2016-05-03 11:54 ` [PATCH 7/7] perf tools: Move sort__has_comm " Jiri Olsa
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_thread into struct perf_hpp_list.

Link: http://lkml.kernel.org/n/tip-iaxriza328jnh7w2cl1zilgm@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 12 ++++++------
 tools/perf/util/hist.h         |  1 +
 tools/perf/util/sort.c         |  3 +--
 tools/perf/util/sort.h         |  1 -
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b25bf82c121f..dda5b4322945 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2135,7 +2135,7 @@ static int hists__browser_title(struct hists *hists,
 		printed += snprintf(bf + printed, size - printed,
 				    ", UID: %s", hists->uid_filter_str);
 	if (thread) {
-		if (sort__has_thread) {
+		if (hists__has(hists, thread)) {
 			printed += scnprintf(bf + printed, size - printed,
 				    ", Thread: %s(%d)",
 				     (thread->comm_set ? thread__comm_str(thread) : ""),
@@ -2320,7 +2320,7 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 {
 	struct thread *thread = act->thread;
 
-	if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
 		return 0;
 
 	if (browser->hists->thread_filter) {
@@ -2329,7 +2329,7 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 		thread__zput(browser->hists->thread_filter);
 		ui_helpline__pop();
 	} else {
-		if (sort__has_thread) {
+		if (hists__has(browser->hists, thread)) {
 			ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"",
 					   thread->comm_set ? thread__comm_str(thread) : "",
 					   thread->tid);
@@ -2354,10 +2354,10 @@ add_thread_opt(struct hist_browser *browser, struct popup_action *act,
 {
 	int ret;
 
-	if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
 		return 0;
 
-	if (sort__has_thread) {
+	if (hists__has(browser->hists, thread)) {
 		ret = asprintf(optstr, "Zoom %s %s(%d) thread",
 			       browser->hists->thread_filter ? "out of" : "into",
 			       thread->comm_set ? thread__comm_str(thread) : "",
@@ -2954,7 +2954,7 @@ skip_annotation:
 			goto skip_scripting;
 
 		if (browser->he_selection) {
-			if (sort__has_thread && thread) {
+			if (hists__has(hists, thread) && thread) {
 				nr_options += add_script_opt(browser,
 							     &actions[nr_options],
 							     &options[nr_options],
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 66f313936faf..adeb4049c488 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -246,6 +246,7 @@ struct perf_hpp_list {
 	int sym;
 	int dso;
 	int socket;
+	int thread;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 712a71ad76a6..000d6e901841 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_thread = 0;
 int		sort__has_comm = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
 
@@ -2257,7 +2256,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		} else if (sd->entry == &sort_socket) {
 			list->socket = 1;
 		} else if (sd->entry == &sort_thread) {
-			sort__has_thread = 1;
+			list->thread = 1;
 		} else if (sd->entry == &sort_comm) {
 			sort__has_comm = 1;
 		}
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 85424a608074..e8d1bf147522 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_thread;
 extern int sort__has_comm;
 extern enum sort_mode sort__mode;
 extern struct sort_entry sort_comm;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] perf tools: Move sort__has_comm into struct perf_hpp_list
  2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
                   ` (5 preceding siblings ...)
  2016-05-03 11:54 ` [PATCH 6/7] perf tools: Move sort__has_thread " Jiri Olsa
@ 2016-05-03 11:54 ` Jiri Olsa
  2016-05-06  6:44   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
  6 siblings, 1 reply; 15+ messages in thread
From: Jiri Olsa @ 2016-05-03 11:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_comm into struct perf_hpp_list.

Link: http://lkml.kernel.org/n/tip-gco57jvvwwtcivm197n0htyy@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 6 ++++--
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 3 +--
 tools/perf/util/sort.h         | 1 -
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index dda5b4322945..538bae880bfe 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2320,7 +2320,8 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 {
 	struct thread *thread = act->thread;
 
-	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) &&
+	     !hists__has(browser->hists, comm)) || thread == NULL)
 		return 0;
 
 	if (browser->hists->thread_filter) {
@@ -2354,7 +2355,8 @@ add_thread_opt(struct hist_browser *browser, struct popup_action *act,
 {
 	int ret;
 
-	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) &&
+	     !hists__has(browser->hists, comm)) || thread == NULL)
 		return 0;
 
 	if (hists__has(browser->hists, thread)) {
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index adeb4049c488..0f84bfb42bb1 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -247,6 +247,7 @@ struct perf_hpp_list {
 	int dso;
 	int socket;
 	int thread;
+	int comm;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 000d6e901841..772e2e461ec3 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_comm = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
 
 /*
@@ -2258,7 +2257,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		} else if (sd->entry == &sort_thread) {
 			list->thread = 1;
 		} else if (sd->entry == &sort_comm) {
-			sort__has_comm = 1;
+			list->comm = 1;
 		}
 
 		return __sort_dimension__add(sd, list, level);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index e8d1bf147522..42927f448bcb 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_comm;
 extern enum sort_mode sort__mode;
 extern struct sort_entry sort_comm;
 extern struct sort_entry sort_dso;
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__need_collapse into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 1/7] perf tools: Move sort__need_collapse " Jiri Olsa
@ 2016-05-06  6:42   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namhyung, tglx, mingo, jolsa, linux-kernel, acme, dsahern,
	a.p.zijlstra, hpa

Commit-ID:  52225036fa8f5aca4c1b7b4f12742f72a1bf9d73
Gitweb:     http://git.kernel.org/tip/52225036fa8f5aca4c1b7b4f12742f72a1bf9d73
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:42 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:03:58 -0300

perf hists: Move sort__need_collapse into struct perf_hpp_list

Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.

Moving sort__need_collapse into struct perf_hpp_list.

Adding hists__has macro to easily access this info perf struct hists
object.

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/1462276488-26683-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c         |  4 ++--
 tools/perf/builtin-report.c       |  2 +-
 tools/perf/builtin-top.c          |  2 +-
 tools/perf/tests/hists_common.c   |  2 +-
 tools/perf/tests/hists_cumulate.c |  2 +-
 tools/perf/tests/hists_link.c     |  4 ++--
 tools/perf/tests/hists_output.c   |  2 +-
 tools/perf/util/hist.c            | 14 +++++++-------
 tools/perf/util/hist.h            |  4 ++++
 tools/perf/util/sort.c            |  5 ++---
 tools/perf/util/sort.h            |  1 -
 11 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 8053a8c..9ce354f 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -428,7 +428,7 @@ static void hists__baseline_only(struct hists *hists)
 	struct rb_root *root;
 	struct rb_node *next;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -450,7 +450,7 @@ static void hists__precompute(struct hists *hists)
 	struct rb_root *root;
 	struct rb_node *next;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8d9b88a..394d05e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -936,7 +936,7 @@ repeat:
 			goto error;
 		}
 
-		sort__need_collapse = true;
+		perf_hpp_list.need_collapse = true;
 	}
 
 	/* Force tty output for header output and per-thread stat. */
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index da18517..ff61098 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1255,7 +1255,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	sort__mode = SORT_MODE__TOP;
 	/* display thread wants entries to be collapsed in a different tree */
-	sort__need_collapse = 1;
+	perf_hpp_list.need_collapse = 1;
 
 	if (top.use_stdio)
 		use_browser = 0;
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index f55f4bd..6b21746 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -161,7 +161,7 @@ void print_hists_in(struct hists *hists)
 	struct rb_root *root;
 	struct rb_node *node;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index 4a2bbff9..a9e3db3 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -126,7 +126,7 @@ static void del_hist_entries(struct hists *hists)
 	struct rb_root *root_out;
 	struct rb_node *node;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root_in = &hists->entries_collapsed;
 	else
 		root_in = hists->entries_in;
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 358324e..acf5a13 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -145,7 +145,7 @@ static int __validate_match(struct hists *hists)
 	/*
 	 * Only entries from fake_common_samples should have a pair.
 	 */
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -197,7 +197,7 @@ static int __validate_link(struct hists *hists, int idx)
 	 * and some entries will have no pair.  However every entry
 	 * in other hists should have (dummy) pair.
 	 */
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index 7cd8738..63c5efa 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -92,7 +92,7 @@ static void del_hist_entries(struct hists *hists)
 	struct rb_root *root_out;
 	struct rb_node *node;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root_in = &hists->entries_collapsed;
 	else
 		root_in = hists->entries_in;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 0f33d7e..cfab531 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -295,7 +295,7 @@ static void hists__delete_entry(struct hists *hists, struct hist_entry *he)
 		root_in  = &he->parent_he->hroot_in;
 		root_out = &he->parent_he->hroot_out;
 	} else {
-		if (sort__need_collapse)
+		if (hists__has(hists, need_collapse))
 			root_in = &hists->entries_collapsed;
 		else
 			root_in = hists->entries_in;
@@ -1373,7 +1373,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
 	struct hist_entry *n;
 	int ret;
 
-	if (!sort__need_collapse)
+	if (!hists__has(hists, need_collapse))
 		return 0;
 
 	hists->nr_entries = 0;
@@ -1632,7 +1632,7 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
 		return;
 	}
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -2036,7 +2036,7 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
 	struct hist_entry *he;
 	int64_t cmp;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		root = &hists->entries_collapsed;
 	else
 		root = hists->entries_in;
@@ -2078,7 +2078,7 @@ static struct hist_entry *hists__find_entry(struct hists *hists,
 {
 	struct rb_node *n;
 
-	if (sort__need_collapse)
+	if (hists__has(hists, need_collapse))
 		n = hists->entries_collapsed.rb_node;
 	else
 		n = hists->entries_in->rb_node;
@@ -2107,7 +2107,7 @@ void hists__match(struct hists *leader, struct hists *other)
 	struct rb_node *nd;
 	struct hist_entry *pos, *pair;
 
-	if (sort__need_collapse)
+	if (hists__has(leader, need_collapse))
 		root = &leader->entries_collapsed;
 	else
 		root = leader->entries_in;
@@ -2132,7 +2132,7 @@ int hists__link(struct hists *leader, struct hists *other)
 	struct rb_node *nd;
 	struct hist_entry *pos, *pair;
 
-	if (sort__need_collapse)
+	if (hists__has(other, need_collapse))
 		root = &other->entries_collapsed;
 	else
 		root = other->entries_in;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 5885965..ec76e6b 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -82,6 +82,8 @@ struct hists {
 	int			nr_hpp_node;
 };
 
+#define hists__has(__h, __f) (__h)->hpp_list->__f
+
 struct hist_entry_iter;
 
 struct hist_iter_ops {
@@ -238,6 +240,8 @@ struct perf_hpp_fmt {
 struct perf_hpp_list {
 	struct list_head fields;
 	struct list_head sorts;
+
+	int need_collapse;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 47966a1..64ace54 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__need_collapse = 0;
 int		sort__has_parent = 0;
 int		sort__has_sym = 0;
 int		sort__has_dso = 0;
@@ -2163,7 +2162,7 @@ static int __sort_dimension__add(struct sort_dimension *sd,
 		return -1;
 
 	if (sd->entry->se_collapse)
-		sort__need_collapse = 1;
+		list->need_collapse = 1;
 
 	sd->taken = 1;
 
@@ -2746,7 +2745,7 @@ int setup_sorting(struct perf_evlist *evlist)
 
 void reset_output_field(void)
 {
-	sort__need_collapse = 0;
+	perf_hpp_list.need_collapse = 0;
 	sort__has_parent = 0;
 	sort__has_sym = 0;
 	sort__has_dso = 0;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 3f4e359..2e1d273 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__need_collapse;
 extern int sort__has_dso;
 extern int sort__has_parent;
 extern int sort__has_sym;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__has_parent into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 2/7] perf tools: Move sort__has_parent " Jiri Olsa
@ 2016-05-06  6:42   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namhyung, linux-kernel, dsahern, jolsa, hpa, tglx, acme, mingo,
	a.p.zijlstra

Commit-ID:  de7e6a7c8bf9ee46dcbee749bc3cdd0d9c21998a
Gitweb:     http://git.kernel.org/tip/de7e6a7c8bf9ee46dcbee749bc3cdd0d9c21998a
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:43 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:03:59 -0300

perf hists: Move sort__has_parent into struct perf_hpp_list

Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.

Moving sort__has_parent into struct perf_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/1462276488-26683-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 2 +-
 tools/perf/util/callchain.c | 2 +-
 tools/perf/util/hist.h      | 1 +
 tools/perf/util/machine.c   | 2 +-
 tools/perf/util/sort.c      | 5 ++---
 tools/perf/util/sort.h      | 1 -
 6 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 394d05e..87d40e3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -234,7 +234,7 @@ static int report__setup_sample_type(struct report *rep)
 		sample_type |= PERF_SAMPLE_BRANCH_STACK;
 
 	if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
-		if (sort__has_parent) {
+		if (perf_hpp_list.parent) {
 			ui__error("Selected --sort parent, but no "
 				    "callchain data. Did you call "
 				    "'perf record' without -g?\n");
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index aa248dc..07fd30b 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -799,7 +799,7 @@ int sample__resolve_callchain(struct perf_sample *sample,
 		return 0;
 
 	if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain ||
-	    sort__has_parent) {
+	    perf_hpp_list.parent) {
 		return thread__resolve_callchain(al->thread, cursor, evsel, sample,
 						 parent, al, max_stack);
 	}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index ec76e6b..57b0979 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -242,6 +242,7 @@ struct perf_hpp_list {
 	struct list_head sorts;
 
 	int need_collapse;
+	int parent;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 9d09131..8c7bf4d 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1652,7 +1652,7 @@ static int add_callchain_ip(struct thread *thread,
 	}
 
 	if (al.sym != NULL) {
-		if (sort__has_parent && !*parent &&
+		if (perf_hpp_list.parent && !*parent &&
 		    symbol__match_regex(al.sym, &parent_regex))
 			*parent = al.sym;
 		else if (have_ignore_callees && root_al &&
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 64ace54..75b33d3 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_parent = 0;
 int		sort__has_sym = 0;
 int		sort__has_dso = 0;
 int		sort__has_socket = 0;
@@ -2244,7 +2243,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 				pr_err("Invalid regex: %s\n%s", parent_pattern, err);
 				return -EINVAL;
 			}
-			sort__has_parent = 1;
+			list->parent = 1;
 		} else if (sd->entry == &sort_sym) {
 			sort__has_sym = 1;
 			/*
@@ -2746,7 +2745,7 @@ int setup_sorting(struct perf_evlist *evlist)
 void reset_output_field(void)
 {
 	perf_hpp_list.need_collapse = 0;
-	sort__has_parent = 0;
+	perf_hpp_list.parent = 0;
 	sort__has_sym = 0;
 	sort__has_dso = 0;
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 2e1d273..0e44aea 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -32,7 +32,6 @@ extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
 extern int sort__has_dso;
-extern int sort__has_parent;
 extern int sort__has_sym;
 extern int sort__has_socket;
 extern int sort__has_thread;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__has_sym into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 3/7] perf tools: Move sort__has_sym " Jiri Olsa
@ 2016-05-06  6:42   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, tglx, jolsa, hpa, linux-kernel, a.p.zijlstra, acme,
	namhyung, dsahern

Commit-ID:  2e0453af4e16e97268b9e66aad37beb607ed7c0f
Gitweb:     http://git.kernel.org/tip/2e0453af4e16e97268b9e66aad37beb607ed7c0f
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:44 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:03:59 -0300

perf hists: Move sort__has_sym into struct perf_hpp_list

Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.

Moving sort__has_sym into struct perf_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/1462276488-26683-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c       | 4 ++--
 tools/perf/ui/browsers/hists.c | 6 +++---
 tools/perf/ui/gtk/hists.c      | 2 +-
 tools/perf/ui/hist.c           | 2 +-
 tools/perf/util/annotate.c     | 2 +-
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 9 ++++-----
 tools/perf/util/sort.h         | 1 -
 8 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ff61098..39fe06f 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -688,7 +688,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
 	struct hist_entry *he = iter->he;
 	struct perf_evsel *evsel = iter->evsel;
 
-	if (sort__has_sym && single)
+	if (perf_hpp_list.sym && single)
 		perf_top__record_precise_ip(top, he, evsel->idx, al->addr);
 
 	hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
@@ -919,7 +919,7 @@ out_err:
 
 static int callchain_param__setup_sample_type(struct callchain_param *callchain)
 {
-	if (!sort__has_sym) {
+	if (!perf_hpp_list.sym) {
 		if (callchain->enabled) {
 			ui__error("Selected -g but \"sym\" not present in --sort/-s.");
 			return -EINVAL;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6a46819..b66bf83 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2747,7 +2747,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 			 */
 			goto out_free_stack;
 		case 'a':
-			if (!sort__has_sym) {
+			if (!hists__has(hists, sym)) {
 				ui_browser__warning(&browser->b, delay_secs * 2,
 			"Annotation is only available for symbolic views, "
 			"include \"sym*\" in --sort to use it.");
@@ -2910,7 +2910,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 			continue;
 		}
 
-		if (!sort__has_sym || browser->selection == NULL)
+		if (!hists__has(hists, sym) || browser->selection == NULL)
 			goto skip_annotation;
 
 		if (sort__mode == SORT_MODE__BRANCH) {
@@ -2969,7 +2969,7 @@ skip_annotation:
 			 *
 			 * See hist_browser__show_entry.
 			 */
-			if (sort__has_sym && browser->selection->sym) {
+			if (hists__has(hists, sym) && browser->selection->sym) {
 				nr_options += add_script_opt(browser,
 							     &actions[nr_options],
 							     &options[nr_options],
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 2aa45b6..932adfa 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -379,7 +379,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
 			gtk_tree_store_set(store, &iter, col_idx++, s, -1);
 		}
 
-		if (symbol_conf.use_callchain && sort__has_sym) {
+		if (symbol_conf.use_callchain && hists__has(hists, sym)) {
 			if (callchain_param.mode == CHAIN_GRAPH_REL)
 				total = symbol_conf.cumulate_callchain ?
 					h->stat_acc->period : h->stat.period;
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 3baeaa6..af07ffb 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -635,7 +635,7 @@ unsigned int hists__sort_list_width(struct hists *hists)
 		ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
 	}
 
-	if (verbose && sort__has_sym) /* Addr + origin */
+	if (verbose && hists__has(hists, sym)) /* Addr + origin */
 		ret += 3 + BITS_PER_LONG / 4;
 
 	return ret;
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index b795b69..d4b3d03 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1665,5 +1665,5 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize)
 
 bool ui__has_annotation(void)
 {
-	return use_browser == 1 && sort__has_sym;
+	return use_browser == 1 && perf_hpp_list.sym;
 }
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 57b0979..c3a7750 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -243,6 +243,7 @@ struct perf_hpp_list {
 
 	int need_collapse;
 	int parent;
+	int sym;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 75b33d3..544ab37 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_sym = 0;
 int		sort__has_dso = 0;
 int		sort__has_socket = 0;
 int		sort__has_thread = 0;
@@ -2245,7 +2244,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 			}
 			list->parent = 1;
 		} else if (sd->entry == &sort_sym) {
-			sort__has_sym = 1;
+			list->sym = 1;
 			/*
 			 * perf diff displays the performance difference amongst
 			 * two or more perf.data files. Those files could come
@@ -2287,7 +2286,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 			return -EINVAL;
 
 		if (sd->entry == &sort_sym_from || sd->entry == &sort_sym_to)
-			sort__has_sym = 1;
+			list->sym = 1;
 
 		__sort_dimension__add(sd, list, level);
 		return 0;
@@ -2303,7 +2302,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 			return -EINVAL;
 
 		if (sd->entry == &sort_mem_daddr_sym)
-			sort__has_sym = 1;
+			list->sym = 1;
 
 		__sort_dimension__add(sd, list, level);
 		return 0;
@@ -2746,7 +2745,7 @@ void reset_output_field(void)
 {
 	perf_hpp_list.need_collapse = 0;
 	perf_hpp_list.parent = 0;
-	sort__has_sym = 0;
+	perf_hpp_list.sym = 0;
 	sort__has_dso = 0;
 
 	field_order = NULL;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 0e44aea..9a5e7d4 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -32,7 +32,6 @@ extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
 extern int sort__has_dso;
-extern int sort__has_sym;
 extern int sort__has_socket;
 extern int sort__has_thread;
 extern int sort__has_comm;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__has_dso into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 4/7] perf tools: Move sort__has_dso " Jiri Olsa
@ 2016-05-06  6:43   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, dsahern, mingo, a.p.zijlstra, hpa, namhyung,
	jolsa, tglx

Commit-ID:  69849fc5d2119799509026df7a6fd5ffe5a578b3
Gitweb:     http://git.kernel.org/tip/69849fc5d2119799509026df7a6fd5ffe5a578b3
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:45 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:04:00 -0300

perf hists: Move sort__has_dso into struct perf_hpp_list

Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.

Moving sort__has_dso into struct perf_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/1462276488-26683-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 8 ++++----
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 7 +++----
 tools/perf/util/sort.h         | 1 -
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b66bf83..6b2f953 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2380,7 +2380,7 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
 {
 	struct map *map = act->ms.map;
 
-	if (!sort__has_dso || map == NULL)
+	if (!hists__has(browser->hists, dso) || map == NULL)
 		return 0;
 
 	if (browser->hists->dso_filter) {
@@ -2407,7 +2407,7 @@ static int
 add_dso_opt(struct hist_browser *browser, struct popup_action *act,
 	    char **optstr, struct map *map)
 {
-	if (!sort__has_dso || map == NULL)
+	if (!hists__has(browser->hists, dso) || map == NULL)
 		return 0;
 
 	if (asprintf(optstr, "Zoom %s %s DSO",
@@ -2429,10 +2429,10 @@ do_browse_map(struct hist_browser *browser __maybe_unused,
 }
 
 static int
-add_map_opt(struct hist_browser *browser __maybe_unused,
+add_map_opt(struct hist_browser *browser,
 	    struct popup_action *act, char **optstr, struct map *map)
 {
-	if (!sort__has_dso || map == NULL)
+	if (!hists__has(browser->hists, dso) || map == NULL)
 		return 0;
 
 	if (asprintf(optstr, "Browse map details") < 0)
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index c3a7750..4302f34 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -244,6 +244,7 @@ struct perf_hpp_list {
 	int need_collapse;
 	int parent;
 	int sym;
+	int dso;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 544ab37..2446c39 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_dso = 0;
 int		sort__has_socket = 0;
 int		sort__has_thread = 0;
 int		sort__has_comm = 0;
@@ -241,7 +240,7 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
 	 * comparing symbol address alone is not enough since it's a
 	 * relative address within a dso.
 	 */
-	if (!sort__has_dso) {
+	if (!hists__has(left->hists, dso) || hists__has(right->hists, dso)) {
 		ret = sort__dso_cmp(left, right);
 		if (ret != 0)
 			return ret;
@@ -2255,7 +2254,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 				sd->entry->se_collapse = sort__sym_sort;
 
 		} else if (sd->entry == &sort_dso) {
-			sort__has_dso = 1;
+			list->dso = 1;
 		} else if (sd->entry == &sort_socket) {
 			sort__has_socket = 1;
 		} else if (sd->entry == &sort_thread) {
@@ -2746,7 +2745,7 @@ void reset_output_field(void)
 	perf_hpp_list.need_collapse = 0;
 	perf_hpp_list.parent = 0;
 	perf_hpp_list.sym = 0;
-	sort__has_dso = 0;
+	perf_hpp_list.dso = 0;
 
 	field_order = NULL;
 	sort_order = NULL;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 9a5e7d4..87d4addf 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_dso;
 extern int sort__has_socket;
 extern int sort__has_thread;
 extern int sort__has_comm;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__has_socket into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 5/7] perf tools: Move sort__has_socket " Jiri Olsa
@ 2016-05-06  6:43   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: dsahern, acme, mingo, tglx, jolsa, hpa, namhyung, a.p.zijlstra,
	linux-kernel

Commit-ID:  35a634f76c02b98d31397a589544022b478c0e12
Gitweb:     http://git.kernel.org/tip/35a634f76c02b98d31397a589544022b478c0e12
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:46 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:04:01 -0300

perf hists: Move sort__has_socket into struct perf_hpp_list

Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.

Moving sort__has_socket into struct perf_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/1462276488-26683-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c       | 2 +-
 tools/perf/ui/browsers/hists.c | 4 ++--
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 3 +--
 tools/perf/util/sort.h         | 1 -
 5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 39fe06f..1793da5 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -962,7 +962,7 @@ static int __cmd_top(struct perf_top *top)
 	machine__synthesize_threads(&top->session->machines.host, &opts->target,
 				    top->evlist->threads, false, opts->proc_map_timeout);
 
-	if (sort__has_socket) {
+	if (perf_hpp_list.socket) {
 		ret = perf_env__read_cpu_topology_map(&perf_env);
 		if (ret < 0)
 			goto out_err_cpu_topo;
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6b2f953..b25bf82 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2534,7 +2534,7 @@ add_exit_opt(struct hist_browser *browser __maybe_unused,
 static int
 do_zoom_socket(struct hist_browser *browser, struct popup_action *act)
 {
-	if (!sort__has_socket || act->socket < 0)
+	if (!hists__has(browser->hists, socket) || act->socket < 0)
 		return 0;
 
 	if (browser->hists->socket_filter > -1) {
@@ -2556,7 +2556,7 @@ static int
 add_socket_opt(struct hist_browser *browser, struct popup_action *act,
 	       char **optstr, int socket_id)
 {
-	if (!sort__has_socket || socket_id < 0)
+	if (!hists__has(browser->hists, socket) || socket_id < 0)
 		return 0;
 
 	if (asprintf(optstr, "Zoom %s Processor Socket %d",
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 4302f34..66f3139 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -245,6 +245,7 @@ struct perf_hpp_list {
 	int parent;
 	int sym;
 	int dso;
+	int socket;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 2446c39..712a71a 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_socket = 0;
 int		sort__has_thread = 0;
 int		sort__has_comm = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
@@ -2256,7 +2255,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		} else if (sd->entry == &sort_dso) {
 			list->dso = 1;
 		} else if (sd->entry == &sort_socket) {
-			sort__has_socket = 1;
+			list->socket = 1;
 		} else if (sd->entry == &sort_thread) {
 			sort__has_thread = 1;
 		} else if (sd->entry == &sort_comm) {
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 87d4addf..85424a6 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_socket;
 extern int sort__has_thread;
 extern int sort__has_comm;
 extern enum sort_mode sort__mode;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__has_thread into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 6/7] perf tools: Move sort__has_thread " Jiri Olsa
@ 2016-05-06  6:44   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, jolsa, linux-kernel, namhyung, a.p.zijlstra, acme,
	dsahern, hpa, tglx

Commit-ID:  fa82911a1bdf4f9870ffca097d7fe21128b5639c
Gitweb:     http://git.kernel.org/tip/fa82911a1bdf4f9870ffca097d7fe21128b5639c
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:47 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:04:01 -0300

perf hists: Move sort__has_thread into struct perf_hpp_list

Now we have sort dimensions private for struct hists, we need to make
dimension booleans hists specific as well.

Moving sort__has_thread into struct perf_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/1462276488-26683-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 12 ++++++------
 tools/perf/util/hist.h         |  1 +
 tools/perf/util/sort.c         |  3 +--
 tools/perf/util/sort.h         |  1 -
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b25bf82..dda5b43 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2135,7 +2135,7 @@ static int hists__browser_title(struct hists *hists,
 		printed += snprintf(bf + printed, size - printed,
 				    ", UID: %s", hists->uid_filter_str);
 	if (thread) {
-		if (sort__has_thread) {
+		if (hists__has(hists, thread)) {
 			printed += scnprintf(bf + printed, size - printed,
 				    ", Thread: %s(%d)",
 				     (thread->comm_set ? thread__comm_str(thread) : ""),
@@ -2320,7 +2320,7 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 {
 	struct thread *thread = act->thread;
 
-	if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
 		return 0;
 
 	if (browser->hists->thread_filter) {
@@ -2329,7 +2329,7 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 		thread__zput(browser->hists->thread_filter);
 		ui_helpline__pop();
 	} else {
-		if (sort__has_thread) {
+		if (hists__has(browser->hists, thread)) {
 			ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"",
 					   thread->comm_set ? thread__comm_str(thread) : "",
 					   thread->tid);
@@ -2354,10 +2354,10 @@ add_thread_opt(struct hist_browser *browser, struct popup_action *act,
 {
 	int ret;
 
-	if ((!sort__has_thread && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
 		return 0;
 
-	if (sort__has_thread) {
+	if (hists__has(browser->hists, thread)) {
 		ret = asprintf(optstr, "Zoom %s %s(%d) thread",
 			       browser->hists->thread_filter ? "out of" : "into",
 			       thread->comm_set ? thread__comm_str(thread) : "",
@@ -2954,7 +2954,7 @@ skip_annotation:
 			goto skip_scripting;
 
 		if (browser->he_selection) {
-			if (sort__has_thread && thread) {
+			if (hists__has(hists, thread) && thread) {
 				nr_options += add_script_opt(browser,
 							     &actions[nr_options],
 							     &options[nr_options],
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 66f3139..adeb404 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -246,6 +246,7 @@ struct perf_hpp_list {
 	int sym;
 	int dso;
 	int socket;
+	int thread;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 712a71a..000d6e9 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_thread = 0;
 int		sort__has_comm = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
 
@@ -2257,7 +2256,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		} else if (sd->entry == &sort_socket) {
 			list->socket = 1;
 		} else if (sd->entry == &sort_thread) {
-			sort__has_thread = 1;
+			list->thread = 1;
 		} else if (sd->entry == &sort_comm) {
 			sort__has_comm = 1;
 		}
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 85424a6..e8d1bf1 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_thread;
 extern int sort__has_comm;
 extern enum sort_mode sort__mode;
 extern struct sort_entry sort_comm;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip:perf/core] perf hists: Move sort__has_comm into struct perf_hpp_list
  2016-05-03 11:54 ` [PATCH 7/7] perf tools: Move sort__has_comm " Jiri Olsa
@ 2016-05-06  6:44   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-05-06  6:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mingo, a.p.zijlstra, dsahern, namhyung, tglx, hpa,
	acme, jolsa

Commit-ID:  7cecb7fe8388d5c39708d7f07e642ed31bb9d4fe
Gitweb:     http://git.kernel.org/tip/7cecb7fe8388d5c39708d7f07e642ed31bb9d4fe
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 3 May 2016 13:54:48 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:04:02 -0300

perf hists: Move sort__has_comm into struct perf_hpp_list

Now we have sort dimensions private for struct hists,
we need to make dimension booleans hists specific as
well.

Moving sort__has_comm into struct perf_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/1462276488-26683-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 6 ++++--
 tools/perf/util/hist.h         | 1 +
 tools/perf/util/sort.c         | 3 +--
 tools/perf/util/sort.h         | 1 -
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index dda5b43..538bae8 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2320,7 +2320,8 @@ do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
 {
 	struct thread *thread = act->thread;
 
-	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) &&
+	     !hists__has(browser->hists, comm)) || thread == NULL)
 		return 0;
 
 	if (browser->hists->thread_filter) {
@@ -2354,7 +2355,8 @@ add_thread_opt(struct hist_browser *browser, struct popup_action *act,
 {
 	int ret;
 
-	if ((!hists__has(browser->hists, thread) && !sort__has_comm) || thread == NULL)
+	if ((!hists__has(browser->hists, thread) &&
+	     !hists__has(browser->hists, comm)) || thread == NULL)
 		return 0;
 
 	if (hists__has(browser->hists, thread)) {
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index adeb404..0f84bfb 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -247,6 +247,7 @@ struct perf_hpp_list {
 	int dso;
 	int socket;
 	int thread;
+	int comm;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 000d6e9..772e2e4 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -21,7 +21,6 @@ const char	*sort_order;
 const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
-int		sort__has_comm = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
 
 /*
@@ -2258,7 +2257,7 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		} else if (sd->entry == &sort_thread) {
 			list->thread = 1;
 		} else if (sd->entry == &sort_comm) {
-			sort__has_comm = 1;
+			list->comm = 1;
 		}
 
 		return __sort_dimension__add(sd, list, level);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index e8d1bf1..42927f4 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,7 +31,6 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
-extern int sort__has_comm;
 extern enum sort_mode sort__mode;
 extern struct sort_entry sort_comm;
 extern struct sort_entry sort_dso;

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-05-06  6:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 11:54 [PATCH 0/7] perf tools: Move sort bools into struct perf_hpp_list Jiri Olsa
2016-05-03 11:54 ` [PATCH 1/7] perf tools: Move sort__need_collapse " Jiri Olsa
2016-05-06  6:42   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-05-03 11:54 ` [PATCH 2/7] perf tools: Move sort__has_parent " Jiri Olsa
2016-05-06  6:42   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-05-03 11:54 ` [PATCH 3/7] perf tools: Move sort__has_sym " Jiri Olsa
2016-05-06  6:42   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-05-03 11:54 ` [PATCH 4/7] perf tools: Move sort__has_dso " Jiri Olsa
2016-05-06  6:43   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-05-03 11:54 ` [PATCH 5/7] perf tools: Move sort__has_socket " Jiri Olsa
2016-05-06  6:43   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-05-03 11:54 ` [PATCH 6/7] perf tools: Move sort__has_thread " Jiri Olsa
2016-05-06  6:44   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
2016-05-03 11:54 ` [PATCH 7/7] perf tools: Move sort__has_comm " Jiri Olsa
2016-05-06  6:44   ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).