Lines Matching refs:hists

12 static bool hists__filter_entry_by_dso(struct hists *hists,
14 static bool hists__filter_entry_by_thread(struct hists *hists,
16 static bool hists__filter_entry_by_symbol(struct hists *hists,
19 u16 hists__col_len(struct hists *hists, enum hist_column col) in hists__col_len() argument
21 return hists->col_len[col]; in hists__col_len()
24 void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len) in hists__set_col_len() argument
26 hists->col_len[col] = len; in hists__set_col_len()
29 bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len) in hists__new_col_len() argument
31 if (len > hists__col_len(hists, col)) { in hists__new_col_len()
32 hists__set_col_len(hists, col, len); in hists__new_col_len()
38 void hists__reset_col_len(struct hists *hists) in hists__reset_col_len() argument
43 hists__set_col_len(hists, col, 0); in hists__reset_col_len()
46 static void hists__set_unres_dso_col_len(struct hists *hists, int dso) in hists__set_unres_dso_col_len() argument
50 if (hists__col_len(hists, dso) < unresolved_col_width && in hists__set_unres_dso_col_len()
53 hists__set_col_len(hists, dso, unresolved_col_width); in hists__set_unres_dso_col_len()
56 void hists__calc_col_len(struct hists *hists, struct hist_entry *h) in hists__calc_col_len() argument
71 hists__new_col_len(hists, HISTC_SYMBOL, symlen); in hists__calc_col_len()
74 hists__new_col_len(hists, HISTC_SYMBOL, symlen); in hists__calc_col_len()
75 hists__set_unres_dso_col_len(hists, HISTC_DSO); in hists__calc_col_len()
79 if (hists__new_col_len(hists, HISTC_COMM, len)) in hists__calc_col_len()
80 hists__set_col_len(hists, HISTC_THREAD, len + 6); in hists__calc_col_len()
84 hists__new_col_len(hists, HISTC_DSO, len); in hists__calc_col_len()
88 hists__new_col_len(hists, HISTC_PARENT, h->parent->namelen); in hists__calc_col_len()
95 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); in hists__calc_col_len()
98 hists__new_col_len(hists, HISTC_DSO_FROM, symlen); in hists__calc_col_len()
101 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); in hists__calc_col_len()
102 hists__set_unres_dso_col_len(hists, HISTC_DSO_FROM); in hists__calc_col_len()
109 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); in hists__calc_col_len()
112 hists__new_col_len(hists, HISTC_DSO_TO, symlen); in hists__calc_col_len()
115 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); in hists__calc_col_len()
116 hists__set_unres_dso_col_len(hists, HISTC_DSO_TO); in hists__calc_col_len()
124 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, in hists__calc_col_len()
126 hists__new_col_len(hists, HISTC_MEM_DCACHELINE, in hists__calc_col_len()
130 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, in hists__calc_col_len()
135 hists__new_col_len(hists, HISTC_MEM_DADDR_DSO, in hists__calc_col_len()
139 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO); in hists__calc_col_len()
143 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen); in hists__calc_col_len()
144 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO); in hists__calc_col_len()
147 hists__new_col_len(hists, HISTC_MEM_LOCKED, 6); in hists__calc_col_len()
148 hists__new_col_len(hists, HISTC_MEM_TLB, 22); in hists__calc_col_len()
149 hists__new_col_len(hists, HISTC_MEM_SNOOP, 12); in hists__calc_col_len()
150 hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3); in hists__calc_col_len()
151 hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); in hists__calc_col_len()
152 hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); in hists__calc_col_len()
155 hists__new_col_len(hists, HISTC_SRCLINE, strlen(h->srcline)); in hists__calc_col_len()
158 hists__new_col_len(hists, HISTC_TRANSACTION, in hists__calc_col_len()
162 void hists__output_recalc_col_len(struct hists *hists, int max_rows) in hists__output_recalc_col_len() argument
164 struct rb_node *next = rb_first(&hists->entries); in hists__output_recalc_col_len()
168 hists__reset_col_len(hists); in hists__output_recalc_col_len()
173 hists__calc_col_len(hists, n); in hists__output_recalc_col_len()
226 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) in hists__decay_entry() argument
240 hists->stats.total_period -= diff; in hists__decay_entry()
242 hists->stats.total_non_filtered_period -= diff; in hists__decay_entry()
247 static void hists__delete_entry(struct hists *hists, struct hist_entry *he) in hists__delete_entry() argument
249 rb_erase(&he->rb_node, &hists->entries); in hists__delete_entry()
252 rb_erase(&he->rb_node_in, &hists->entries_collapsed); in hists__delete_entry()
254 --hists->nr_entries; in hists__delete_entry()
256 --hists->nr_non_filtered_entries; in hists__delete_entry()
261 void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel) in hists__decay_entries() argument
263 struct rb_node *next = rb_first(&hists->entries); in hists__decay_entries()
271 hists__decay_entry(hists, n))) { in hists__decay_entries()
272 hists__delete_entry(hists, n); in hists__decay_entries()
277 void hists__delete_entries(struct hists *hists) in hists__delete_entries() argument
279 struct rb_node *next = rb_first(&hists->entries); in hists__delete_entries()
286 hists__delete_entry(hists, n); in hists__delete_entries()
368 static struct hist_entry *add_hist_entry(struct hists *hists, in add_hist_entry() argument
380 p = &hists->entries_in->rb_node; in add_hist_entry()
430 hists->nr_entries++; in add_hist_entry()
433 rb_insert_color(&he->rb_node_in, hists->entries_in); in add_hist_entry()
442 struct hist_entry *__hists__add_entry(struct hists *hists, in __hists__add_entry() argument
468 .hists = hists, in __hists__add_entry()
474 return add_hist_entry(hists, &entry, al, sample_self); in __hists__add_entry()
510 struct hists *hists = evsel__hists(iter->evsel); in iter_add_single_mem_entry() local
527 he = __hists__add_entry(hists, al, iter->parent, NULL, mi, in iter_add_single_mem_entry()
541 struct hists *hists = evsel__hists(evsel); in iter_finish_mem_entry() local
548 hists__inc_nr_samples(hists, he->filtered); in iter_finish_mem_entry()
614 struct hists *hists = evsel__hists(evsel); in iter_add_next_branch_entry() local
628 he = __hists__add_entry(hists, al, iter->parent, &bi[i], NULL, in iter_add_next_branch_entry()
633 hists__inc_nr_samples(hists, he->filtered); in iter_add_next_branch_entry()
721 struct hists *hists = evsel__hists(evsel); in iter_add_single_cumulative_entry() local
727 he = __hists__add_entry(hists, al, iter->parent, NULL, NULL, in iter_add_single_cumulative_entry()
744 hists__inc_nr_samples(hists, he->filtered); in iter_add_single_cumulative_entry()
955 static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, in hists__collapse_insert_entry()
990 hists->nr_entries++; in hists__collapse_insert_entry()
997 static struct rb_root *hists__get_rotate_entries_in(struct hists *hists) in hists__get_rotate_entries_in() argument
1001 pthread_mutex_lock(&hists->lock); in hists__get_rotate_entries_in()
1003 root = hists->entries_in; in hists__get_rotate_entries_in()
1004 if (++hists->entries_in > &hists->entries_in_array[1]) in hists__get_rotate_entries_in()
1005 hists->entries_in = &hists->entries_in_array[0]; in hists__get_rotate_entries_in()
1007 pthread_mutex_unlock(&hists->lock); in hists__get_rotate_entries_in()
1012 static void hists__apply_filters(struct hists *hists, struct hist_entry *he) in hists__apply_filters() argument
1014 hists__filter_entry_by_dso(hists, he); in hists__apply_filters()
1015 hists__filter_entry_by_thread(hists, he); in hists__apply_filters()
1016 hists__filter_entry_by_symbol(hists, he); in hists__apply_filters()
1019 void hists__collapse_resort(struct hists *hists, struct ui_progress *prog) in hists__collapse_resort() argument
1028 hists->nr_entries = 0; in hists__collapse_resort()
1030 root = hists__get_rotate_entries_in(hists); in hists__collapse_resort()
1041 if (hists__collapse_insert_entry(hists, &hists->entries_collapsed, n)) { in hists__collapse_resort()
1047 hists__apply_filters(hists, n); in hists__collapse_resort()
1071 static void hists__reset_filter_stats(struct hists *hists) in hists__reset_filter_stats() argument
1073 hists->nr_non_filtered_entries = 0; in hists__reset_filter_stats()
1074 hists->stats.total_non_filtered_period = 0; in hists__reset_filter_stats()
1077 void hists__reset_stats(struct hists *hists) in hists__reset_stats() argument
1079 hists->nr_entries = 0; in hists__reset_stats()
1080 hists->stats.total_period = 0; in hists__reset_stats()
1082 hists__reset_filter_stats(hists); in hists__reset_stats()
1085 static void hists__inc_filter_stats(struct hists *hists, struct hist_entry *h) in hists__inc_filter_stats() argument
1087 hists->nr_non_filtered_entries++; in hists__inc_filter_stats()
1088 hists->stats.total_non_filtered_period += h->stat.period; in hists__inc_filter_stats()
1091 void hists__inc_stats(struct hists *hists, struct hist_entry *h) in hists__inc_stats() argument
1094 hists__inc_filter_stats(hists, h); in hists__inc_stats()
1096 hists->nr_entries++; in hists__inc_stats()
1097 hists->stats.total_period += h->stat.period; in hists__inc_stats()
1126 void hists__output_resort(struct hists *hists, struct ui_progress *prog) in hists__output_resort() argument
1133 min_callchain_hits = hists->stats.total_period * (callchain_param.min_percent / 100); in hists__output_resort()
1136 root = &hists->entries_collapsed; in hists__output_resort()
1138 root = hists->entries_in; in hists__output_resort()
1141 hists->entries = RB_ROOT; in hists__output_resort()
1143 hists__reset_stats(hists); in hists__output_resort()
1144 hists__reset_col_len(hists); in hists__output_resort()
1150 __hists__insert_output_entry(&hists->entries, n, min_callchain_hits); in hists__output_resort()
1151 hists__inc_stats(hists, n); in hists__output_resort()
1154 hists__calc_col_len(hists, n); in hists__output_resort()
1161 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h, in hists__remove_entry_filter() argument
1173 hists->stats.nr_non_filtered_samples += h->stat.nr_events; in hists__remove_entry_filter()
1175 hists__inc_filter_stats(hists, h); in hists__remove_entry_filter()
1176 hists__calc_col_len(hists, h); in hists__remove_entry_filter()
1180 static bool hists__filter_entry_by_dso(struct hists *hists, in hists__filter_entry_by_dso() argument
1183 if (hists->dso_filter != NULL && in hists__filter_entry_by_dso()
1184 (he->ms.map == NULL || he->ms.map->dso != hists->dso_filter)) { in hists__filter_entry_by_dso()
1192 void hists__filter_by_dso(struct hists *hists) in hists__filter_by_dso() argument
1196 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_dso()
1198 hists__reset_filter_stats(hists); in hists__filter_by_dso()
1199 hists__reset_col_len(hists); in hists__filter_by_dso()
1201 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_dso()
1207 if (hists__filter_entry_by_dso(hists, h)) in hists__filter_by_dso()
1210 hists__remove_entry_filter(hists, h, HIST_FILTER__DSO); in hists__filter_by_dso()
1214 static bool hists__filter_entry_by_thread(struct hists *hists, in hists__filter_entry_by_thread() argument
1217 if (hists->thread_filter != NULL && in hists__filter_entry_by_thread()
1218 he->thread != hists->thread_filter) { in hists__filter_entry_by_thread()
1226 void hists__filter_by_thread(struct hists *hists) in hists__filter_by_thread() argument
1230 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_thread()
1232 hists__reset_filter_stats(hists); in hists__filter_by_thread()
1233 hists__reset_col_len(hists); in hists__filter_by_thread()
1235 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_thread()
1238 if (hists__filter_entry_by_thread(hists, h)) in hists__filter_by_thread()
1241 hists__remove_entry_filter(hists, h, HIST_FILTER__THREAD); in hists__filter_by_thread()
1245 static bool hists__filter_entry_by_symbol(struct hists *hists, in hists__filter_entry_by_symbol() argument
1248 if (hists->symbol_filter_str != NULL && in hists__filter_entry_by_symbol()
1250 hists->symbol_filter_str) == NULL)) { in hists__filter_entry_by_symbol()
1258 void hists__filter_by_symbol(struct hists *hists) in hists__filter_by_symbol() argument
1262 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_symbol()
1264 hists__reset_filter_stats(hists); in hists__filter_by_symbol()
1265 hists__reset_col_len(hists); in hists__filter_by_symbol()
1267 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_symbol()
1270 if (hists__filter_entry_by_symbol(hists, h)) in hists__filter_by_symbol()
1273 hists__remove_entry_filter(hists, h, HIST_FILTER__SYMBOL); in hists__filter_by_symbol()
1283 void hists__inc_nr_events(struct hists *hists, u32 type) in hists__inc_nr_events() argument
1285 events_stats__inc(&hists->stats, type); in hists__inc_nr_events()
1288 void hists__inc_nr_samples(struct hists *hists, bool filtered) in hists__inc_nr_samples() argument
1290 events_stats__inc(&hists->stats, PERF_RECORD_SAMPLE); in hists__inc_nr_samples()
1292 hists->stats.nr_non_filtered_samples++; in hists__inc_nr_samples()
1295 static struct hist_entry *hists__add_dummy_entry(struct hists *hists, in hists__add_dummy_entry() argument
1305 root = &hists->entries_collapsed; in hists__add_dummy_entry()
1307 root = hists->entries_in; in hists__add_dummy_entry()
1329 he->hists = hists; in hists__add_dummy_entry()
1332 hists__inc_stats(hists, he); in hists__add_dummy_entry()
1339 static struct hist_entry *hists__find_entry(struct hists *hists, in hists__find_entry() argument
1345 n = hists->entries_collapsed.rb_node; in hists__find_entry()
1347 n = hists->entries_in->rb_node; in hists__find_entry()
1367 void hists__match(struct hists *leader, struct hists *other) in hists__match()
1392 int hists__link(struct hists *leader, struct hists *other) in hists__link()
1432 u64 hists__total_period(struct hists *hists) in hists__total_period() argument
1434 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : in hists__total_period()
1435 hists->stats.total_period; in hists__total_period()
1461 struct hists *hists = evsel__hists(evsel); in hists_evsel__init() local
1463 memset(hists, 0, sizeof(*hists)); in hists_evsel__init()
1464 hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; in hists_evsel__init()
1465 hists->entries_in = &hists->entries_in_array[0]; in hists_evsel__init()
1466 hists->entries_collapsed = RB_ROOT; in hists_evsel__init()
1467 hists->entries = RB_ROOT; in hists_evsel__init()
1468 pthread_mutex_init(&hists->lock, NULL); in hists_evsel__init()