9 static bool hists__filter_entry_by_dso(
struct hists *
hists,
11 static bool hists__filter_entry_by_thread(
struct hists *
hists,
13 static bool hists__filter_entry_by_symbol(
struct hists *
hists,
56 static void hists__set_unres_dso_col_len(
struct hists *
hists,
int dso)
74 hists__set_unres_dso_col_len(hists,
HISTC_DSO);
98 symlen = unresolved_col_width + 4 + 2;
110 symlen = unresolved_col_width + 4 + 2;
125 while (next && row++ < max_rows) {
133 static void hist_entry__add_cpumode_period(
struct hist_entry *he,
170 static void hist_entry__decay(
struct hist_entry *he)
172 he->
stat.period = (he->
stat.period * 7) / 8;
173 he->
stat.nr_events = (he->
stat.nr_events * 7) / 8;
176 static bool hists__decay_entry(
struct hists *hists,
struct hist_entry *he)
178 u64 prev_period = he->
stat.period;
180 if (prev_period == 0)
183 hist_entry__decay(he);
186 hists->
stats.total_period -= prev_period - he->
stat.period;
188 return he->
stat.period == 0;
191 static void __hists__decay_entries(
struct hists *hists,
bool zap_user,
192 bool zap_kernel,
bool threaded)
205 if (((zap_user && n->
level ==
'.') ||
206 (zap_kernel && n->
level !=
'.') ||
207 hists__decay_entry(hists, n)) &&
222 return __hists__decay_entries(hists, zap_user, zap_kernel,
false);
226 bool zap_user,
bool zap_kernel)
228 return __hists__decay_entries(hists, zap_user, zap_kernel,
true);
244 he->
ms.map->referenced =
true;
252 static void hists__inc_nr_entries(
struct hists *hists,
struct hist_entry *
h)
257 hists->
stats.total_period += h->
stat.period;
261 static u8 symbol__parent_filter(
const struct symbol *parent)
268 static struct hist_entry *add_hist_entry(
struct hists *hists,
278 pthread_mutex_lock(&hists->
lock);
289 he_stat__add_period(&he->
stat, period);
297 if (he->
ms.map != entry->
ms.map) {
298 he->
ms.map = entry->
ms.map;
300 he->
ms.map->referenced =
true;
311 he = hist_entry__new(entry);
318 hist_entry__add_cpumode_period(he, al->
cpumode, period);
320 pthread_mutex_unlock(&hists->
lock);
326 struct symbol *sym_parent,
343 .parent = sym_parent,
344 .filtered = symbol__parent_filter(sym_parent),
349 return add_hist_entry(
self, &entry, al, period);
369 .parent = sym_parent,
370 .filtered = symbol__parent_filter(sym_parent),
374 return add_hist_entry(
self, &entry, al, period);
384 cmp = se->
se_cmp(left, right);
403 cmp =
f(left, right);
420 static bool hists__collapse_insert_entry(
struct hists *hists
__maybe_unused,
436 he_stat__add_stat(&iter->
stat, &he->
stat);
459 static struct rb_root *hists__get_rotate_entries_in(
struct hists *hists)
463 pthread_mutex_lock(&hists->
lock);
469 pthread_mutex_unlock(&hists->
lock);
474 static void hists__apply_filters(
struct hists *hists,
struct hist_entry *he)
476 hists__filter_entry_by_dso(hists, he);
477 hists__filter_entry_by_thread(hists, he);
478 hists__filter_entry_by_symbol(hists, he);
481 static void __hists__collapse_resort(
struct hists *hists,
bool threaded)
490 root = hists__get_rotate_entries_in(hists);
504 hists__apply_filters(hists, n);
511 return __hists__collapse_resort(hists,
false);
516 return __hists__collapse_resort(hists,
true);
525 u64 min_callchain_hits)
533 min_callchain_hits, &callchain_param);
539 if (he->
stat.period > iter->
stat.period)
545 rb_link_node(&he->
rb_node, parent, p);
549 static void __hists__output_resort(
struct hists *hists,
bool threaded)
554 u64 min_callchain_hits;
556 min_callchain_hits = hists->
stats.total_period * (callchain_param.
min_percent / 100);
567 hists->
stats.total_period = 0;
574 __hists__insert_output_entry(&hists->
entries, n, min_callchain_hits);
575 hists__inc_nr_entries(hists, n);
581 return __hists__output_resort(hists,
false);
586 return __hists__output_resort(hists,
true);
589 static void hists__remove_entry_filter(
struct hists *hists,
struct hist_entry *h,
600 hists->
stats.total_period += h->
stat.period;
607 static bool hists__filter_entry_by_dso(
struct hists *hists,
633 if (hists__filter_entry_by_dso(hists, h))
640 static bool hists__filter_entry_by_thread(
struct hists *hists,
663 if (hists__filter_entry_by_thread(hists, h))
670 static bool hists__filter_entry_by_symbol(
struct hists *hists,
694 if (hists__filter_entry_by_symbol(hists, h))
713 ++hists->
stats.nr_events[0];