diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-19 11:09:10 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-19 11:09:10 -0400 |
commit | 90cf1fb5c09fef77514083a64914b6b47fa0dad0 (patch) | |
tree | 19817a4471b19c30e5bb36f872f6c217bc569f6b /tools/perf/util/hist.c | |
parent | d7b76f0935d294e9abaac1577cdc2137eff15a49 (diff) |
perf hists browser: Apply the dso and thread filters when merging new batches
Now that we dynamicly add entries on the timer we need to not only
traverse all entries when the user zooms into threads and/or DSOs, but
as well after that apply it to the new batches of hist entries in
hists__collapse_resort.
Reported-by: Mike Galbraith <efault@gmx.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-zustn633c7hnrae94x6nld1p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r-- | tools/perf/util/hist.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index fdff2a8288b4..75526d123eb2 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -6,6 +6,11 @@ | |||
6 | #include "sort.h" | 6 | #include "sort.h" |
7 | #include <math.h> | 7 | #include <math.h> |
8 | 8 | ||
9 | static bool hists__filter_entry_by_dso(struct hists *hists, | ||
10 | struct hist_entry *he); | ||
11 | static bool hists__filter_entry_by_thread(struct hists *hists, | ||
12 | struct hist_entry *he); | ||
13 | |||
9 | enum hist_filter { | 14 | enum hist_filter { |
10 | HIST_FILTER__DSO, | 15 | HIST_FILTER__DSO, |
11 | HIST_FILTER__THREAD, | 16 | HIST_FILTER__THREAD, |
@@ -338,6 +343,12 @@ static struct rb_root *hists__get_rotate_entries_in(struct hists *hists) | |||
338 | return root; | 343 | return root; |
339 | } | 344 | } |
340 | 345 | ||
346 | static void hists__apply_filters(struct hists *hists, struct hist_entry *he) | ||
347 | { | ||
348 | hists__filter_entry_by_dso(hists, he); | ||
349 | hists__filter_entry_by_thread(hists, he); | ||
350 | } | ||
351 | |||
341 | static void __hists__collapse_resort(struct hists *hists, bool threaded) | 352 | static void __hists__collapse_resort(struct hists *hists, bool threaded) |
342 | { | 353 | { |
343 | struct rb_root *root; | 354 | struct rb_root *root; |
@@ -356,8 +367,15 @@ static void __hists__collapse_resort(struct hists *hists, bool threaded) | |||
356 | next = rb_next(&n->rb_node_in); | 367 | next = rb_next(&n->rb_node_in); |
357 | 368 | ||
358 | rb_erase(&n->rb_node_in, root); | 369 | rb_erase(&n->rb_node_in, root); |
359 | if (hists__collapse_insert_entry(hists, &hists->entries_collapsed, n)) | 370 | if (hists__collapse_insert_entry(hists, &hists->entries_collapsed, n)) { |
371 | /* | ||
372 | * If it wasn't combined with one of the entries already | ||
373 | * collapsed, we need to apply the filters that may have | ||
374 | * been set by, say, the hist_browser. | ||
375 | */ | ||
376 | hists__apply_filters(hists, n); | ||
360 | hists__inc_nr_entries(hists, n); | 377 | hists__inc_nr_entries(hists, n); |
378 | } | ||
361 | } | 379 | } |
362 | } | 380 | } |
363 | 381 | ||
@@ -1087,6 +1105,19 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h | |||
1087 | hists__calc_col_len(hists, h); | 1105 | hists__calc_col_len(hists, h); |
1088 | } | 1106 | } |
1089 | 1107 | ||
1108 | |||
1109 | static bool hists__filter_entry_by_dso(struct hists *hists, | ||
1110 | struct hist_entry *he) | ||
1111 | { | ||
1112 | if (hists->dso_filter != NULL && | ||
1113 | (he->ms.map == NULL || he->ms.map->dso != hists->dso_filter)) { | ||
1114 | he->filtered |= (1 << HIST_FILTER__DSO); | ||
1115 | return true; | ||
1116 | } | ||
1117 | |||
1118 | return false; | ||
1119 | } | ||
1120 | |||
1090 | void hists__filter_by_dso(struct hists *hists) | 1121 | void hists__filter_by_dso(struct hists *hists) |
1091 | { | 1122 | { |
1092 | struct rb_node *nd; | 1123 | struct rb_node *nd; |
@@ -1101,16 +1132,25 @@ void hists__filter_by_dso(struct hists *hists) | |||
1101 | if (symbol_conf.exclude_other && !h->parent) | 1132 | if (symbol_conf.exclude_other && !h->parent) |
1102 | continue; | 1133 | continue; |
1103 | 1134 | ||
1104 | if (hists->dso_filter != NULL && | 1135 | if (hists__filter_entry_by_dso(hists, h)) |
1105 | (h->ms.map == NULL || h->ms.map->dso != hists->dso_filter)) { | ||
1106 | h->filtered |= (1 << HIST_FILTER__DSO); | ||
1107 | continue; | 1136 | continue; |
1108 | } | ||
1109 | 1137 | ||
1110 | hists__remove_entry_filter(hists, h, HIST_FILTER__DSO); | 1138 | hists__remove_entry_filter(hists, h, HIST_FILTER__DSO); |
1111 | } | 1139 | } |
1112 | } | 1140 | } |
1113 | 1141 | ||
1142 | static bool hists__filter_entry_by_thread(struct hists *hists, | ||
1143 | struct hist_entry *he) | ||
1144 | { | ||
1145 | if (hists->thread_filter != NULL && | ||
1146 | he->thread != hists->thread_filter) { | ||
1147 | he->filtered |= (1 << HIST_FILTER__THREAD); | ||
1148 | return true; | ||
1149 | } | ||
1150 | |||
1151 | return false; | ||
1152 | } | ||
1153 | |||
1114 | void hists__filter_by_thread(struct hists *hists) | 1154 | void hists__filter_by_thread(struct hists *hists) |
1115 | { | 1155 | { |
1116 | struct rb_node *nd; | 1156 | struct rb_node *nd; |
@@ -1122,11 +1162,8 @@ void hists__filter_by_thread(struct hists *hists) | |||
1122 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { | 1162 | for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { |
1123 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 1163 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
1124 | 1164 | ||
1125 | if (hists->thread_filter != NULL && | 1165 | if (hists__filter_entry_by_thread(hists, h)) |
1126 | h->thread != hists->thread_filter) { | ||
1127 | h->filtered |= (1 << HIST_FILTER__THREAD); | ||
1128 | continue; | 1166 | continue; |
1129 | } | ||
1130 | 1167 | ||
1131 | hists__remove_entry_filter(hists, h, HIST_FILTER__THREAD); | 1168 | hists__remove_entry_filter(hists, h, HIST_FILTER__THREAD); |
1132 | } | 1169 | } |