diff options
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 20 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 6 |
2 files changed, 22 insertions, 4 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 769295bf2c10..886eee0062e0 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -35,6 +35,11 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size, | |||
35 | const char *ev_name); | 35 | const char *ev_name); |
36 | static void hist_browser__update_nr_entries(struct hist_browser *hb); | 36 | static void hist_browser__update_nr_entries(struct hist_browser *hb); |
37 | 37 | ||
38 | static bool hist_browser__has_filter(struct hist_browser *hb) | ||
39 | { | ||
40 | return hists__has_filter(hb->hists) || hb->min_pcnt; | ||
41 | } | ||
42 | |||
38 | static void hist_browser__refresh_dimensions(struct hist_browser *browser) | 43 | static void hist_browser__refresh_dimensions(struct hist_browser *browser) |
39 | { | 44 | { |
40 | /* 3 == +/- toggle symbol before actual hist_entry rendering */ | 45 | /* 3 == +/- toggle symbol before actual hist_entry rendering */ |
@@ -44,7 +49,8 @@ static void hist_browser__refresh_dimensions(struct hist_browser *browser) | |||
44 | 49 | ||
45 | static void hist_browser__reset(struct hist_browser *browser) | 50 | static void hist_browser__reset(struct hist_browser *browser) |
46 | { | 51 | { |
47 | browser->b.nr_entries = browser->hists->nr_entries; | 52 | hist_browser__update_nr_entries(browser); |
53 | browser->b.nr_entries = browser->nr_non_filtered_entries; | ||
48 | hist_browser__refresh_dimensions(browser); | 54 | hist_browser__refresh_dimensions(browser); |
49 | ui_browser__reset_index(&browser->b); | 55 | ui_browser__reset_index(&browser->b); |
50 | } | 56 | } |
@@ -319,9 +325,10 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name, | |||
319 | int delay_secs = hbt ? hbt->refresh : 0; | 325 | int delay_secs = hbt ? hbt->refresh : 0; |
320 | 326 | ||
321 | browser->b.entries = &browser->hists->entries; | 327 | browser->b.entries = &browser->hists->entries; |
322 | browser->b.nr_entries = browser->hists->nr_entries; | 328 | if (hist_browser__has_filter(browser)) |
323 | if (browser->min_pcnt) | ||
324 | browser->b.nr_entries = browser->nr_non_filtered_entries; | 329 | browser->b.nr_entries = browser->nr_non_filtered_entries; |
330 | else | ||
331 | browser->b.nr_entries = browser->hists->nr_entries; | ||
325 | 332 | ||
326 | hist_browser__refresh_dimensions(browser); | 333 | hist_browser__refresh_dimensions(browser); |
327 | hists__browser_title(browser->hists, title, sizeof(title), ev_name); | 334 | hists__browser_title(browser->hists, title, sizeof(title), ev_name); |
@@ -338,7 +345,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name, | |||
338 | u64 nr_entries; | 345 | u64 nr_entries; |
339 | hbt->timer(hbt->arg); | 346 | hbt->timer(hbt->arg); |
340 | 347 | ||
341 | if (browser->min_pcnt) { | 348 | if (hist_browser__has_filter(browser)) { |
342 | hist_browser__update_nr_entries(browser); | 349 | hist_browser__update_nr_entries(browser); |
343 | nr_entries = browser->nr_non_filtered_entries; | 350 | nr_entries = browser->nr_non_filtered_entries; |
344 | } else { | 351 | } else { |
@@ -1347,6 +1354,11 @@ static void hist_browser__update_nr_entries(struct hist_browser *hb) | |||
1347 | u64 nr_entries = 0; | 1354 | u64 nr_entries = 0; |
1348 | struct rb_node *nd = rb_first(&hb->hists->entries); | 1355 | struct rb_node *nd = rb_first(&hb->hists->entries); |
1349 | 1356 | ||
1357 | if (hb->min_pcnt == 0) { | ||
1358 | hb->nr_non_filtered_entries = hb->hists->nr_non_filtered_entries; | ||
1359 | return; | ||
1360 | } | ||
1361 | |||
1350 | while ((nd = hists__filter_entries(nd, hb->hists, | 1362 | while ((nd = hists__filter_entries(nd, hb->hists, |
1351 | hb->min_pcnt)) != NULL) { | 1363 | hb->min_pcnt)) != NULL) { |
1352 | nr_entries++; | 1364 | nr_entries++; |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index ef1ad7a948c0..38c3e874c164 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -129,6 +129,12 @@ void hists__filter_by_dso(struct hists *hists); | |||
129 | void hists__filter_by_thread(struct hists *hists); | 129 | void hists__filter_by_thread(struct hists *hists); |
130 | void hists__filter_by_symbol(struct hists *hists); | 130 | void hists__filter_by_symbol(struct hists *hists); |
131 | 131 | ||
132 | static inline bool hists__has_filter(struct hists *hists) | ||
133 | { | ||
134 | return hists->thread_filter || hists->dso_filter || | ||
135 | hists->symbol_filter_str; | ||
136 | } | ||
137 | |||
132 | u16 hists__col_len(struct hists *hists, enum hist_column col); | 138 | u16 hists__col_len(struct hists *hists, enum hist_column col); |
133 | void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len); | 139 | void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len); |
134 | bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len); | 140 | bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len); |