Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
52225036 4679bcca

+22 -20
+2 -2
tools/perf/builtin-diff.c
··· 428 428 struct rb_root *root; 429 429 struct rb_node *next; 430 430 431 - if (sort__need_collapse) 431 + if (hists__has(hists, need_collapse)) 432 432 root = &hists->entries_collapsed; 433 433 else 434 434 root = hists->entries_in; ··· 450 450 struct rb_root *root; 451 451 struct rb_node *next; 452 452 453 - if (sort__need_collapse) 453 + if (hists__has(hists, need_collapse)) 454 454 root = &hists->entries_collapsed; 455 455 else 456 456 root = hists->entries_in;
+1 -1
tools/perf/builtin-report.c
··· 936 936 goto error; 937 937 } 938 938 939 - sort__need_collapse = true; 939 + perf_hpp_list.need_collapse = true; 940 940 } 941 941 942 942 /* Force tty output for header output and per-thread stat. */
+1 -1
tools/perf/builtin-top.c
··· 1255 1255 1256 1256 sort__mode = SORT_MODE__TOP; 1257 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 1260 if (top.use_stdio) 1261 1261 use_browser = 0;
+1 -1
tools/perf/tests/hists_common.c
··· 161 161 struct rb_root *root; 162 162 struct rb_node *node; 163 163 164 - if (sort__need_collapse) 164 + if (hists__has(hists, need_collapse)) 165 165 root = &hists->entries_collapsed; 166 166 else 167 167 root = hists->entries_in;
+1 -1
tools/perf/tests/hists_cumulate.c
··· 126 126 struct rb_root *root_out; 127 127 struct rb_node *node; 128 128 129 - if (sort__need_collapse) 129 + if (hists__has(hists, need_collapse)) 130 130 root_in = &hists->entries_collapsed; 131 131 else 132 132 root_in = hists->entries_in;
+2 -2
tools/perf/tests/hists_link.c
··· 145 145 /* 146 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 149 root = &hists->entries_collapsed; 150 150 else 151 151 root = hists->entries_in; ··· 197 197 * and some entries will have no pair. However every entry 198 198 * in other hists should have (dummy) pair. 199 199 */ 200 - if (sort__need_collapse) 200 + if (hists__has(hists, need_collapse)) 201 201 root = &hists->entries_collapsed; 202 202 else 203 203 root = hists->entries_in;
+1 -1
tools/perf/tests/hists_output.c
··· 92 92 struct rb_root *root_out; 93 93 struct rb_node *node; 94 94 95 - if (sort__need_collapse) 95 + if (hists__has(hists, need_collapse)) 96 96 root_in = &hists->entries_collapsed; 97 97 else 98 98 root_in = hists->entries_in;
+7 -7
tools/perf/util/hist.c
··· 295 295 root_in = &he->parent_he->hroot_in; 296 296 root_out = &he->parent_he->hroot_out; 297 297 } else { 298 - if (sort__need_collapse) 298 + if (hists__has(hists, need_collapse)) 299 299 root_in = &hists->entries_collapsed; 300 300 else 301 301 root_in = hists->entries_in; ··· 1373 1373 struct hist_entry *n; 1374 1374 int ret; 1375 1375 1376 - if (!sort__need_collapse) 1376 + if (!hists__has(hists, need_collapse)) 1377 1377 return 0; 1378 1378 1379 1379 hists->nr_entries = 0; ··· 1632 1632 return; 1633 1633 } 1634 1634 1635 - if (sort__need_collapse) 1635 + if (hists__has(hists, need_collapse)) 1636 1636 root = &hists->entries_collapsed; 1637 1637 else 1638 1638 root = hists->entries_in; ··· 2036 2036 struct hist_entry *he; 2037 2037 int64_t cmp; 2038 2038 2039 - if (sort__need_collapse) 2039 + if (hists__has(hists, need_collapse)) 2040 2040 root = &hists->entries_collapsed; 2041 2041 else 2042 2042 root = hists->entries_in; ··· 2078 2078 { 2079 2079 struct rb_node *n; 2080 2080 2081 - if (sort__need_collapse) 2081 + if (hists__has(hists, need_collapse)) 2082 2082 n = hists->entries_collapsed.rb_node; 2083 2083 else 2084 2084 n = hists->entries_in->rb_node; ··· 2107 2107 struct rb_node *nd; 2108 2108 struct hist_entry *pos, *pair; 2109 2109 2110 - if (sort__need_collapse) 2110 + if (hists__has(leader, need_collapse)) 2111 2111 root = &leader->entries_collapsed; 2112 2112 else 2113 2113 root = leader->entries_in; ··· 2132 2132 struct rb_node *nd; 2133 2133 struct hist_entry *pos, *pair; 2134 2134 2135 - if (sort__need_collapse) 2135 + if (hists__has(other, need_collapse)) 2136 2136 root = &other->entries_collapsed; 2137 2137 else 2138 2138 root = other->entries_in;
+4
tools/perf/util/hist.h
··· 82 82 int nr_hpp_node; 83 83 }; 84 84 85 + #define hists__has(__h, __f) (__h)->hpp_list->__f 86 + 85 87 struct hist_entry_iter; 86 88 87 89 struct hist_iter_ops { ··· 240 238 struct perf_hpp_list { 241 239 struct list_head fields; 242 240 struct list_head sorts; 241 + 242 + int need_collapse; 243 243 }; 244 244 245 245 extern struct perf_hpp_list perf_hpp_list;
+2 -3
tools/perf/util/sort.c
··· 21 21 const char *field_order; 22 22 regex_t ignore_callees_regex; 23 23 int have_ignore_callees = 0; 24 - int sort__need_collapse = 0; 25 24 int sort__has_parent = 0; 26 25 int sort__has_sym = 0; 27 26 int sort__has_dso = 0; ··· 2162 2163 return -1; 2163 2164 2164 2165 if (sd->entry->se_collapse) 2165 - sort__need_collapse = 1; 2166 + list->need_collapse = 1; 2166 2167 2167 2168 sd->taken = 1; 2168 2169 ··· 2745 2746 2746 2747 void reset_output_field(void) 2747 2748 { 2748 - sort__need_collapse = 0; 2749 + perf_hpp_list.need_collapse = 0; 2749 2750 sort__has_parent = 0; 2750 2751 sort__has_sym = 0; 2751 2752 sort__has_dso = 0;
-1
tools/perf/util/sort.h
··· 31 31 extern const char default_sort_order[]; 32 32 extern regex_t ignore_callees_regex; 33 33 extern int have_ignore_callees; 34 - extern int sort__need_collapse; 35 34 extern int sort__has_dso; 36 35 extern int sort__has_parent; 37 36 extern int sort__has_sym;