Skip to contentSkip to conversation

perf tools: Move sort bools into struct perf_hpp_list

PATCH New Jiri Olsa 2 participants 15 messages May 3, 2016 – May 6, 2016 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

cover perf tools: Move sort bools into struct perf_hpp_list

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(-)
author reviewer
#1 lore raw

PATCH 1/7 perf tools: 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.

---
 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(-)
tools/perf/builtin-diff.c +2 -2
index 8053a8ceefda..9ce354f469dc 100644
@@ -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;
tools/perf/builtin-report.c +1 -1
index 8d9b88af901d..394d05ec0014 100644
@@ -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. */
tools/perf/builtin-top.c +1 -1
index da18517b1d40..ff6109839cdd 100644
@@ -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;
tools/perf/tests/hists_common.c +1 -1
index f55f4bd47932..6b21746d6eec 100644
@@ -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;
tools/perf/tests/hists_cumulate.c +1 -1
index 4a2bbff9b1ee..a9e3db3afac4 100644
@@ -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;
tools/perf/tests/hists_link.c +2 -2
index 358324e47805..acf5a1301c07 100644
@@ -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;
tools/perf/tests/hists_output.c +1 -1
index 7cd8738e842f..63c5efaba1b5 100644
@@ -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;
tools/perf/util/hist.c +7 -7
index 0f33d7e698c4..cfab531437c7 100644
@@ -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;
tools/perf/util/hist.h +4 -0
index 588596561cb3..ec76e6bef916 100644
@@ -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;
tools/perf/util/sort.c +2 -3
index 47966a1618c7..64ace548dc88 100644
@@ -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;
tools/perf/util/sort.h +0 -1
index 3f4e35998119..2e1d27326954 100644
@@ -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;
Signature · 1 line
2.4.11
#2 lore raw

[tip:perf/core] perf hists: Move sort__need_collapse into struct perf_hpp_list

perf hists: Move sort__need_collapse into struct perf_hpp_list
Commit-ID:  52225036fa8f5aca4c1b7b4f12742f72a1bf9d73
Gitweb:     http://git.kernel.org/tip/52225036fa8f5aca4c1b7b4f12742f72a1bf9d73
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:42 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/builtin-diff.c +2 -2
index 8053a8c..9ce354f 100644
@@ -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;
tools/perf/builtin-report.c +1 -1
index 8d9b88a..394d05e 100644
@@ -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. */
tools/perf/builtin-top.c +1 -1
index da18517..ff61098 100644
@@ -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;
tools/perf/tests/hists_common.c +1 -1
index f55f4bd..6b21746 100644
@@ -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;
tools/perf/tests/hists_cumulate.c +1 -1
index 4a2bbff9..a9e3db3 100644
@@ -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;
tools/perf/tests/hists_link.c +2 -2
index 358324e..acf5a13 100644
@@ -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;
tools/perf/tests/hists_output.c +1 -1
index 7cd8738..63c5efa 100644
@@ -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;
tools/perf/util/hist.c +7 -7
index 0f33d7e..cfab531 100644
@@ -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;
tools/perf/util/hist.h +4 -0
index 5885965..ec76e6b 100644
@@ -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;
tools/perf/util/sort.c +2 -3
index 47966a1..64ace54 100644
@@ -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;
tools/perf/util/sort.h +0 -1
index 3f4e359..2e1d273 100644
@@ -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;
author reviewer
#3 lore raw

PATCH 2/7 perf tools: Move sort__has_parent into struct perf_hpp_list

In reply to Jiri Olsa

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.

---
 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(-)
tools/perf/builtin-report.c +1 -1
index 394d05ec0014..87d40e3c4078 100644
@@ -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");
tools/perf/util/callchain.c +1 -1
index aa248dcb4440..07fd30bc2f81 100644
@@ -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);
 	}
tools/perf/util/hist.h +1 -0
index ec76e6bef916..57b09791c339 100644
@@ -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;
tools/perf/util/machine.c +1 -1
index 2cb95bbf9ea6..0d28025c746e 100644
@@ -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 &&
tools/perf/util/sort.c +2 -3
index 64ace548dc88..75b33d387f50 100644
@@ -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;
 
tools/perf/util/sort.h +0 -1
index 2e1d27326954..0e44aea86800 100644
@@ -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;
Signature · 1 line
2.4.11
#4 lore raw

[tip:perf/core] perf hists: Move sort__has_parent into struct perf_hpp_list

perf hists: Move sort__has_parent into struct perf_hpp_list
Commit-ID:  de7e6a7c8bf9ee46dcbee749bc3cdd0d9c21998a
Gitweb:     http://git.kernel.org/tip/de7e6a7c8bf9ee46dcbee749bc3cdd0d9c21998a
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:43 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/builtin-report.c +1 -1
index 394d05e..87d40e3 100644
@@ -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");
tools/perf/util/callchain.c +1 -1
index aa248dc..07fd30b 100644
@@ -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);
 	}
tools/perf/util/hist.h +1 -0
index ec76e6b..57b0979 100644
@@ -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;
tools/perf/util/machine.c +1 -1
index 9d09131..8c7bf4d 100644
@@ -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 &&
tools/perf/util/sort.c +2 -3
index 64ace54..75b33d3 100644
@@ -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;
 
tools/perf/util/sort.h +0 -1
index 2e1d273..0e44aea 100644
@@ -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;
author reviewer
#5 lore raw

PATCH 3/7 perf tools: Move sort__has_sym into struct perf_hpp_list

In reply to Jiri Olsa

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.

---
 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(-)
tools/perf/builtin-top.c +2 -2
index ff6109839cdd..39fe06fc19d3 100644
@@ -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;
tools/perf/ui/browsers/hists.c +3 -3
index 6a4681932ba5..b66bf83ed883 100644
@@ -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],
tools/perf/ui/gtk/hists.c +1 -1
index 2aa45b606fa4..932adfaa05af 100644
@@ -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;
tools/perf/ui/hist.c +1 -1
index 3baeaa6e71b5..af07ffb129ca 100644
@@ -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;
tools/perf/util/annotate.c +1 -1
index b795b6994144..d4b3d034c503 100644
@@ -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;
 }
tools/perf/util/hist.h +1 -0
index 57b09791c339..c3a77502e22b 100644
@@ -243,6 +243,7 @@ struct perf_hpp_list {
 
 	int need_collapse;
 	int parent;
+	int sym;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +4 -5
index 75b33d387f50..544ab376ac42 100644
@@ -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;
tools/perf/util/sort.h +0 -1
index 0e44aea86800..9a5e7d4a2cac 100644
@@ -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;
Signature · 1 line
2.4.11
#6 lore raw

[tip:perf/core] perf hists: Move sort__has_sym into struct perf_hpp_list

perf hists: Move sort__has_sym into struct perf_hpp_list
Commit-ID:  2e0453af4e16e97268b9e66aad37beb607ed7c0f
Gitweb:     http://git.kernel.org/tip/2e0453af4e16e97268b9e66aad37beb607ed7c0f
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:44 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/builtin-top.c +2 -2
index ff61098..39fe06f 100644
@@ -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;
tools/perf/ui/browsers/hists.c +3 -3
index 6a46819..b66bf83 100644
@@ -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],
tools/perf/ui/gtk/hists.c +1 -1
index 2aa45b6..932adfa 100644
@@ -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;
tools/perf/ui/hist.c +1 -1
index 3baeaa6..af07ffb 100644
@@ -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;
tools/perf/util/annotate.c +1 -1
index b795b69..d4b3d03 100644
@@ -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;
 }
tools/perf/util/hist.h +1 -0
index 57b0979..c3a7750 100644
@@ -243,6 +243,7 @@ struct perf_hpp_list {
 
 	int need_collapse;
 	int parent;
+	int sym;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +4 -5
index 75b33d3..544ab37 100644
@@ -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;
tools/perf/util/sort.h +0 -1
index 0e44aea..9a5e7d4 100644
@@ -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;
author reviewer
#7 lore raw

PATCH 4/7 perf tools: Move sort__has_dso into struct perf_hpp_list

In reply to Jiri Olsa

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.

---
 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(-)
tools/perf/ui/browsers/hists.c +4 -4
index b66bf83ed883..6b2f95300e35 100644
@@ -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)
tools/perf/util/hist.h +1 -0
index c3a77502e22b..4302f34f36ae 100644
@@ -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;
tools/perf/util/sort.c +3 -4
index 544ab376ac42..2446c39b5fa6 100644
@@ -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;
tools/perf/util/sort.h +0 -1
index 9a5e7d4a2cac..87d4addf92b5 100644
@@ -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;
Signature · 1 line
2.4.11
#8 lore raw

[tip:perf/core] perf hists: Move sort__has_dso into struct perf_hpp_list

perf hists: Move sort__has_dso into struct perf_hpp_list
Commit-ID:  69849fc5d2119799509026df7a6fd5ffe5a578b3
Gitweb:     http://git.kernel.org/tip/69849fc5d2119799509026df7a6fd5ffe5a578b3
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:45 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/ui/browsers/hists.c +4 -4
index b66bf83..6b2f953 100644
@@ -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)
tools/perf/util/hist.h +1 -0
index c3a7750..4302f34 100644
@@ -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;
tools/perf/util/sort.c +3 -4
index 544ab37..2446c39 100644
@@ -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;
tools/perf/util/sort.h +0 -1
index 9a5e7d4..87d4addf 100644
@@ -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;
author reviewer
#9 lore raw

PATCH 5/7 perf tools: Move sort__has_socket into struct perf_hpp_list

In reply to Jiri Olsa

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.

---
 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(-)
tools/perf/builtin-top.c +1 -1
index 39fe06fc19d3..1793da585676 100644
@@ -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;
tools/perf/ui/browsers/hists.c +2 -2
index 6b2f95300e35..b25bf82c121f 100644
@@ -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",
tools/perf/util/hist.h +1 -0
index 4302f34f36ae..66f313936faf 100644
@@ -245,6 +245,7 @@ struct perf_hpp_list {
 	int parent;
 	int sym;
 	int dso;
+	int socket;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +1 -2
index 2446c39b5fa6..712a71ad76a6 100644
@@ -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) {
tools/perf/util/sort.h +0 -1
index 87d4addf92b5..85424a608074 100644
@@ -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;
Signature · 1 line
2.4.11
#10 lore raw

[tip:perf/core] perf hists: Move sort__has_socket into struct perf_hpp_list

perf hists: Move sort__has_socket into struct perf_hpp_list
Commit-ID:  35a634f76c02b98d31397a589544022b478c0e12
Gitweb:     http://git.kernel.org/tip/35a634f76c02b98d31397a589544022b478c0e12
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:46 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/builtin-top.c +1 -1
index 39fe06f..1793da5 100644
@@ -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;
tools/perf/ui/browsers/hists.c +2 -2
index 6b2f953..b25bf82 100644
@@ -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",
tools/perf/util/hist.h +1 -0
index 4302f34..66f3139 100644
@@ -245,6 +245,7 @@ struct perf_hpp_list {
 	int parent;
 	int sym;
 	int dso;
+	int socket;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +1 -2
index 2446c39..712a71a 100644
@@ -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) {
tools/perf/util/sort.h +0 -1
index 87d4addf..85424a6 100644
@@ -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;
author reviewer
#11 lore raw

PATCH 6/7 perf tools: Move sort__has_thread into struct perf_hpp_list

In reply to Jiri Olsa

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.

---
 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(-)
tools/perf/ui/browsers/hists.c +6 -6
index b25bf82c121f..dda5b4322945 100644
@@ -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],
tools/perf/util/hist.h +1 -0
index 66f313936faf..adeb4049c488 100644
@@ -246,6 +246,7 @@ struct perf_hpp_list {
 	int sym;
 	int dso;
 	int socket;
+	int thread;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +1 -2
index 712a71ad76a6..000d6e901841 100644
@@ -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;
 		}
tools/perf/util/sort.h +0 -1
index 85424a608074..e8d1bf147522 100644
@@ -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;
Signature · 1 line
2.4.11
#12 lore raw

[tip:perf/core] perf hists: Move sort__has_thread into struct perf_hpp_list

perf hists: Move sort__has_thread into struct perf_hpp_list
Commit-ID:  fa82911a1bdf4f9870ffca097d7fe21128b5639c
Gitweb:     http://git.kernel.org/tip/fa82911a1bdf4f9870ffca097d7fe21128b5639c
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:47 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/ui/browsers/hists.c +6 -6
index b25bf82..dda5b43 100644
@@ -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],
tools/perf/util/hist.h +1 -0
index 66f3139..adeb404 100644
@@ -246,6 +246,7 @@ struct perf_hpp_list {
 	int sym;
 	int dso;
 	int socket;
+	int thread;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +1 -2
index 712a71a..000d6e9 100644
@@ -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;
 		}
tools/perf/util/sort.h +0 -1
index 85424a6..e8d1bf1 100644
@@ -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;
author reviewer
#13 lore raw

PATCH 7/7 perf tools: Move sort__has_comm into struct perf_hpp_list

In reply to Jiri Olsa

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.

---
 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(-)
tools/perf/ui/browsers/hists.c +4 -2
index dda5b4322945..538bae880bfe 100644
@@ -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)) {
tools/perf/util/hist.h +1 -0
index adeb4049c488..0f84bfb42bb1 100644
@@ -247,6 +247,7 @@ struct perf_hpp_list {
 	int dso;
 	int socket;
 	int thread;
+	int comm;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +1 -2
index 000d6e901841..772e2e461ec3 100644
@@ -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);
tools/perf/util/sort.h +0 -1
index e8d1bf147522..42927f448bcb 100644
@@ -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;
Signature · 1 line
2.4.11
#14 lore raw

[tip:perf/core] perf hists: Move sort__has_comm into struct perf_hpp_list

perf hists: Move sort__has_comm into struct perf_hpp_list
Commit-ID:  7cecb7fe8388d5c39708d7f07e642ed31bb9d4fe
Gitweb:     http://git.kernel.org/tip/7cecb7fe8388d5c39708d7f07e642ed31bb9d4fe
Author:     Jiri Olsa <[email protected]>
AuthorDate: Tue, 3 May 2016 13:54:48 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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.

---
 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(-)
tools/perf/ui/browsers/hists.c +4 -2
index dda5b43..538bae8 100644
@@ -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)) {
tools/perf/util/hist.h +1 -0
index adeb404..0f84bfb 100644
@@ -247,6 +247,7 @@ struct perf_hpp_list {
 	int dso;
 	int socket;
 	int thread;
+	int comm;
 };
 
 extern struct perf_hpp_list perf_hpp_list;
tools/perf/util/sort.c +1 -2
index 000d6e9..772e2e4 100644
@@ -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);
tools/perf/util/sort.h +0 -1
index e8d1bf1..42927f4 100644
@@ -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;