diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-05-03 07:54:42 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-05-05 20:03:58 -0400 |
commit | 52225036fa8f5aca4c1b7b4f12742f72a1bf9d73 (patch) | |
tree | 48a01c20e71c67cd76e859489944b952c2210a77 | |
parent | 4679bccaa30893ccc5be35c5c5d44f5ab60c0a08 (diff) |
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>
-rw-r--r-- | tools/perf/builtin-diff.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/hists_common.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/hists_cumulate.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/hists_link.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/hists_output.c | 2 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 14 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 4 | ||||
-rw-r--r-- | tools/perf/util/sort.c | 5 | ||||
-rw-r--r-- | 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) | |||
428 | struct rb_root *root; | 428 | struct rb_root *root; |
429 | struct rb_node *next; | 429 | struct rb_node *next; |
430 | 430 | ||
431 | if (sort__need_collapse) | 431 | if (hists__has(hists, need_collapse)) |
432 | root = &hists->entries_collapsed; | 432 | root = &hists->entries_collapsed; |
433 | else | 433 | else |
434 | root = hists->entries_in; | 434 | root = hists->entries_in; |
@@ -450,7 +450,7 @@ static void hists__precompute(struct hists *hists) | |||
450 | struct rb_root *root; | 450 | struct rb_root *root; |
451 | struct rb_node *next; | 451 | struct rb_node *next; |
452 | 452 | ||
453 | if (sort__need_collapse) | 453 | if (hists__has(hists, need_collapse)) |
454 | root = &hists->entries_collapsed; | 454 | root = &hists->entries_collapsed; |
455 | else | 455 | else |
456 | root = hists->entries_in; | 456 | 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: | |||
936 | goto error; | 936 | goto error; |
937 | } | 937 | } |
938 | 938 | ||
939 | sort__need_collapse = true; | 939 | perf_hpp_list.need_collapse = true; |
940 | } | 940 | } |
941 | 941 | ||
942 | /* Force tty output for header output and per-thread stat. */ | 942 | /* 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) | |||
1255 | 1255 | ||
1256 | sort__mode = SORT_MODE__TOP; | 1256 | sort__mode = SORT_MODE__TOP; |
1257 | /* display thread wants entries to be collapsed in a different tree */ | 1257 | /* display thread wants entries to be collapsed in a different tree */ |
1258 | sort__need_collapse = 1; | 1258 | perf_hpp_list.need_collapse = 1; |
1259 | 1259 | ||
1260 | if (top.use_stdio) | 1260 | if (top.use_stdio) |
1261 | use_browser = 0; | 1261 | 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) | |||
161 | struct rb_root *root; | 161 | struct rb_root *root; |
162 | struct rb_node *node; | 162 | struct rb_node *node; |
163 | 163 | ||
164 | if (sort__need_collapse) | 164 | if (hists__has(hists, need_collapse)) |
165 | root = &hists->entries_collapsed; | 165 | root = &hists->entries_collapsed; |
166 | else | 166 | else |
167 | root = hists->entries_in; | 167 | 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) | |||
126 | struct rb_root *root_out; | 126 | struct rb_root *root_out; |
127 | struct rb_node *node; | 127 | struct rb_node *node; |
128 | 128 | ||
129 | if (sort__need_collapse) | 129 | if (hists__has(hists, need_collapse)) |
130 | root_in = &hists->entries_collapsed; | 130 | root_in = &hists->entries_collapsed; |
131 | else | 131 | else |
132 | root_in = hists->entries_in; | 132 | 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) | |||
145 | /* | 145 | /* |
146 | * Only entries from fake_common_samples should have a pair. | 146 | * Only entries from fake_common_samples should have a pair. |
147 | */ | 147 | */ |
148 | if (sort__need_collapse) | 148 | if (hists__has(hists, need_collapse)) |
149 | root = &hists->entries_collapsed; | 149 | root = &hists->entries_collapsed; |
150 | else | 150 | else |
151 | root = hists->entries_in; | 151 | root = hists->entries_in; |
@@ -197,7 +197,7 @@ static int __validate_link(struct hists *hists, int idx) | |||
197 | * and some entries will have no pair. However every entry | 197 | * and some entries will have no pair. However every entry |
198 | * in other hists should have (dummy) pair. | 198 | * in other hists should have (dummy) pair. |
199 | */ | 199 | */ |
200 | if (sort__need_collapse) | 200 | if (hists__has(hists, need_collapse)) |
201 | root = &hists->entries_collapsed; | 201 | root = &hists->entries_collapsed; |
202 | else | 202 | else |
203 | root = hists->entries_in; | 203 | 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) | |||
92 | struct rb_root *root_out; | 92 | struct rb_root *root_out; |
93 | struct rb_node *node; | 93 | struct rb_node *node; |
94 | 94 | ||
95 | if (sort__need_collapse) | 95 | if (hists__has(hists, need_collapse)) |
96 | root_in = &hists->entries_collapsed; | 96 | root_in = &hists->entries_collapsed; |
97 | else | 97 | else |
98 | root_in = hists->entries_in; | 98 | 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) | |||
295 | root_in = &he->parent_he->hroot_in; | 295 | root_in = &he->parent_he->hroot_in; |
296 | root_out = &he->parent_he->hroot_out; | 296 | root_out = &he->parent_he->hroot_out; |
297 | } else { | 297 | } else { |
298 | if (sort__need_collapse) | 298 | if (hists__has(hists, need_collapse)) |
299 | root_in = &hists->entries_collapsed; | 299 | root_in = &hists->entries_collapsed; |
300 | else | 300 | else |
301 | root_in = hists->entries_in; | 301 | root_in = hists->entries_in; |
@@ -1373,7 +1373,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog) | |||
1373 | struct hist_entry *n; | 1373 | struct hist_entry *n; |
1374 | int ret; | 1374 | int ret; |
1375 | 1375 | ||
1376 | if (!sort__need_collapse) | 1376 | if (!hists__has(hists, need_collapse)) |
1377 | return 0; | 1377 | return 0; |
1378 | 1378 | ||
1379 | hists->nr_entries = 0; | 1379 | hists->nr_entries = 0; |
@@ -1632,7 +1632,7 @@ static void output_resort(struct hists *hists, struct ui_progress *prog, | |||
1632 | return; | 1632 | return; |
1633 | } | 1633 | } |
1634 | 1634 | ||
1635 | if (sort__need_collapse) | 1635 | if (hists__has(hists, need_collapse)) |
1636 | root = &hists->entries_collapsed; | 1636 | root = &hists->entries_collapsed; |
1637 | else | 1637 | else |
1638 | root = hists->entries_in; | 1638 | root = hists->entries_in; |
@@ -2036,7 +2036,7 @@ static struct hist_entry *hists__add_dummy_entry(struct hists *hists, | |||
2036 | struct hist_entry *he; | 2036 | struct hist_entry *he; |
2037 | int64_t cmp; | 2037 | int64_t cmp; |
2038 | 2038 | ||
2039 | if (sort__need_collapse) | 2039 | if (hists__has(hists, need_collapse)) |
2040 | root = &hists->entries_collapsed; | 2040 | root = &hists->entries_collapsed; |
2041 | else | 2041 | else |
2042 | root = hists->entries_in; | 2042 | root = hists->entries_in; |
@@ -2078,7 +2078,7 @@ static struct hist_entry *hists__find_entry(struct hists *hists, | |||
2078 | { | 2078 | { |
2079 | struct rb_node *n; | 2079 | struct rb_node *n; |
2080 | 2080 | ||
2081 | if (sort__need_collapse) | 2081 | if (hists__has(hists, need_collapse)) |
2082 | n = hists->entries_collapsed.rb_node; | 2082 | n = hists->entries_collapsed.rb_node; |
2083 | else | 2083 | else |
2084 | n = hists->entries_in->rb_node; | 2084 | n = hists->entries_in->rb_node; |
@@ -2107,7 +2107,7 @@ void hists__match(struct hists *leader, struct hists *other) | |||
2107 | struct rb_node *nd; | 2107 | struct rb_node *nd; |
2108 | struct hist_entry *pos, *pair; | 2108 | struct hist_entry *pos, *pair; |
2109 | 2109 | ||
2110 | if (sort__need_collapse) | 2110 | if (hists__has(leader, need_collapse)) |
2111 | root = &leader->entries_collapsed; | 2111 | root = &leader->entries_collapsed; |
2112 | else | 2112 | else |
2113 | root = leader->entries_in; | 2113 | root = leader->entries_in; |
@@ -2132,7 +2132,7 @@ int hists__link(struct hists *leader, struct hists *other) | |||
2132 | struct rb_node *nd; | 2132 | struct rb_node *nd; |
2133 | struct hist_entry *pos, *pair; | 2133 | struct hist_entry *pos, *pair; |
2134 | 2134 | ||
2135 | if (sort__need_collapse) | 2135 | if (hists__has(other, need_collapse)) |
2136 | root = &other->entries_collapsed; | 2136 | root = &other->entries_collapsed; |
2137 | else | 2137 | else |
2138 | root = other->entries_in; | 2138 | 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 { | |||
82 | int nr_hpp_node; | 82 | int nr_hpp_node; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #define hists__has(__h, __f) (__h)->hpp_list->__f | ||
86 | |||
85 | struct hist_entry_iter; | 87 | struct hist_entry_iter; |
86 | 88 | ||
87 | struct hist_iter_ops { | 89 | struct hist_iter_ops { |
@@ -238,6 +240,8 @@ struct perf_hpp_fmt { | |||
238 | struct perf_hpp_list { | 240 | struct perf_hpp_list { |
239 | struct list_head fields; | 241 | struct list_head fields; |
240 | struct list_head sorts; | 242 | struct list_head sorts; |
243 | |||
244 | int need_collapse; | ||
241 | }; | 245 | }; |
242 | 246 | ||
243 | extern struct perf_hpp_list perf_hpp_list; | 247 | 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; | |||
21 | const char *field_order; | 21 | const char *field_order; |
22 | regex_t ignore_callees_regex; | 22 | regex_t ignore_callees_regex; |
23 | int have_ignore_callees = 0; | 23 | int have_ignore_callees = 0; |
24 | int sort__need_collapse = 0; | ||
25 | int sort__has_parent = 0; | 24 | int sort__has_parent = 0; |
26 | int sort__has_sym = 0; | 25 | int sort__has_sym = 0; |
27 | int sort__has_dso = 0; | 26 | int sort__has_dso = 0; |
@@ -2163,7 +2162,7 @@ static int __sort_dimension__add(struct sort_dimension *sd, | |||
2163 | return -1; | 2162 | return -1; |
2164 | 2163 | ||
2165 | if (sd->entry->se_collapse) | 2164 | if (sd->entry->se_collapse) |
2166 | sort__need_collapse = 1; | 2165 | list->need_collapse = 1; |
2167 | 2166 | ||
2168 | sd->taken = 1; | 2167 | sd->taken = 1; |
2169 | 2168 | ||
@@ -2746,7 +2745,7 @@ int setup_sorting(struct perf_evlist *evlist) | |||
2746 | 2745 | ||
2747 | void reset_output_field(void) | 2746 | void reset_output_field(void) |
2748 | { | 2747 | { |
2749 | sort__need_collapse = 0; | 2748 | perf_hpp_list.need_collapse = 0; |
2750 | sort__has_parent = 0; | 2749 | sort__has_parent = 0; |
2751 | sort__has_sym = 0; | 2750 | sort__has_sym = 0; |
2752 | sort__has_dso = 0; | 2751 | 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; | |||
31 | extern const char default_sort_order[]; | 31 | extern const char default_sort_order[]; |
32 | extern regex_t ignore_callees_regex; | 32 | extern regex_t ignore_callees_regex; |
33 | extern int have_ignore_callees; | 33 | extern int have_ignore_callees; |
34 | extern int sort__need_collapse; | ||
35 | extern int sort__has_dso; | 34 | extern int sort__has_dso; |
36 | extern int sort__has_parent; | 35 | extern int sort__has_parent; |
37 | extern int sort__has_sym; | 36 | extern int sort__has_sym; |