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,
18 static bool hists__filter_entry_by_socket(struct hists *hists,
21 u16 hists__col_len(struct hists *hists, enum hist_column col) in hists__col_len() argument
23 return hists->col_len[col]; in hists__col_len()
26 void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len) in hists__set_col_len() argument
28 hists->col_len[col] = len; in hists__set_col_len()
31 bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len) in hists__new_col_len() argument
33 if (len > hists__col_len(hists, col)) { in hists__new_col_len()
34 hists__set_col_len(hists, col, len); in hists__new_col_len()
40 void hists__reset_col_len(struct hists *hists) in hists__reset_col_len() argument
45 hists__set_col_len(hists, col, 0); in hists__reset_col_len()
48 static void hists__set_unres_dso_col_len(struct hists *hists, int dso) in hists__set_unres_dso_col_len() argument
52 if (hists__col_len(hists, dso) < unresolved_col_width && in hists__set_unres_dso_col_len()
55 hists__set_col_len(hists, dso, unresolved_col_width); in hists__set_unres_dso_col_len()
58 void hists__calc_col_len(struct hists *hists, struct hist_entry *h) in hists__calc_col_len() argument
73 hists__new_col_len(hists, HISTC_SYMBOL, symlen); in hists__calc_col_len()
76 hists__new_col_len(hists, HISTC_SYMBOL, symlen); in hists__calc_col_len()
77 hists__set_unres_dso_col_len(hists, HISTC_DSO); in hists__calc_col_len()
81 if (hists__new_col_len(hists, HISTC_COMM, len)) in hists__calc_col_len()
82 hists__set_col_len(hists, HISTC_THREAD, len + 6); in hists__calc_col_len()
86 hists__new_col_len(hists, HISTC_DSO, len); in hists__calc_col_len()
90 hists__new_col_len(hists, HISTC_PARENT, h->parent->namelen); in hists__calc_col_len()
97 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); in hists__calc_col_len()
100 hists__new_col_len(hists, HISTC_DSO_FROM, symlen); in hists__calc_col_len()
103 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); in hists__calc_col_len()
104 hists__set_unres_dso_col_len(hists, HISTC_DSO_FROM); in hists__calc_col_len()
111 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); in hists__calc_col_len()
114 hists__new_col_len(hists, HISTC_DSO_TO, symlen); in hists__calc_col_len()
117 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); in hists__calc_col_len()
118 hists__set_unres_dso_col_len(hists, HISTC_DSO_TO); in hists__calc_col_len()
126 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, in hists__calc_col_len()
128 hists__new_col_len(hists, HISTC_MEM_DCACHELINE, in hists__calc_col_len()
132 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, in hists__calc_col_len()
139 hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, in hists__calc_col_len()
143 hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, in hists__calc_col_len()
149 hists__new_col_len(hists, HISTC_MEM_DADDR_DSO, in hists__calc_col_len()
153 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO); in hists__calc_col_len()
157 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen); in hists__calc_col_len()
158 hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, symlen); in hists__calc_col_len()
159 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO); in hists__calc_col_len()
162 hists__new_col_len(hists, HISTC_CPU, 3); in hists__calc_col_len()
163 hists__new_col_len(hists, HISTC_SOCKET, 6); in hists__calc_col_len()
164 hists__new_col_len(hists, HISTC_MEM_LOCKED, 6); in hists__calc_col_len()
165 hists__new_col_len(hists, HISTC_MEM_TLB, 22); in hists__calc_col_len()
166 hists__new_col_len(hists, HISTC_MEM_SNOOP, 12); in hists__calc_col_len()
167 hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3); in hists__calc_col_len()
168 hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); in hists__calc_col_len()
169 hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); in hists__calc_col_len()
172 hists__new_col_len(hists, HISTC_SRCLINE, strlen(h->srcline)); in hists__calc_col_len()
175 hists__new_col_len(hists, HISTC_SRCFILE, strlen(h->srcfile)); in hists__calc_col_len()
178 hists__new_col_len(hists, HISTC_TRANSACTION, in hists__calc_col_len()
182 void hists__output_recalc_col_len(struct hists *hists, int max_rows) in hists__output_recalc_col_len() argument
184 struct rb_node *next = rb_first(&hists->entries); in hists__output_recalc_col_len()
188 hists__reset_col_len(hists); in hists__output_recalc_col_len()
193 hists__calc_col_len(hists, n); in hists__output_recalc_col_len()
246 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) in hists__decay_entry() argument
260 hists->stats.total_period -= diff; in hists__decay_entry()
262 hists->stats.total_non_filtered_period -= diff; in hists__decay_entry()
267 static void hists__delete_entry(struct hists *hists, struct hist_entry *he) in hists__delete_entry() argument
269 rb_erase(&he->rb_node, &hists->entries); in hists__delete_entry()
272 rb_erase(&he->rb_node_in, &hists->entries_collapsed); in hists__delete_entry()
274 --hists->nr_entries; in hists__delete_entry()
276 --hists->nr_non_filtered_entries; in hists__delete_entry()
281 void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel) in hists__decay_entries() argument
283 struct rb_node *next = rb_first(&hists->entries); in hists__decay_entries()
291 hists__decay_entry(hists, n))) { in hists__decay_entries()
292 hists__delete_entry(hists, n); in hists__decay_entries()
297 void hists__delete_entries(struct hists *hists) in hists__delete_entries() argument
299 struct rb_node *next = rb_first(&hists->entries); in hists__delete_entries()
306 hists__delete_entry(hists, n); in hists__delete_entries()
384 static struct hist_entry *hists__findnew_entry(struct hists *hists, in hists__findnew_entry() argument
396 p = &hists->entries_in->rb_node; in hists__findnew_entry()
445 hists->nr_entries++; in hists__findnew_entry()
448 rb_insert_color(&he->rb_node_in, hists->entries_in); in hists__findnew_entry()
457 struct hist_entry *__hists__add_entry(struct hists *hists, in __hists__add_entry() argument
484 .hists = hists, in __hists__add_entry()
490 return hists__findnew_entry(hists, &entry, al, sample_self); in __hists__add_entry()
526 struct hists *hists = evsel__hists(iter->evsel); in iter_add_single_mem_entry() local
543 he = __hists__add_entry(hists, al, iter->parent, NULL, mi, in iter_add_single_mem_entry()
557 struct hists *hists = evsel__hists(evsel); in iter_finish_mem_entry() local
564 hists__inc_nr_samples(hists, he->filtered); in iter_finish_mem_entry()
630 struct hists *hists = evsel__hists(evsel); in iter_add_next_branch_entry() local
644 he = __hists__add_entry(hists, al, iter->parent, &bi[i], NULL, in iter_add_next_branch_entry()
650 hists__inc_nr_samples(hists, he->filtered); in iter_add_next_branch_entry()
738 struct hists *hists = evsel__hists(evsel); in iter_add_single_cumulative_entry() local
744 he = __hists__add_entry(hists, al, iter->parent, NULL, NULL, in iter_add_single_cumulative_entry()
761 hists__inc_nr_samples(hists, he->filtered); in iter_add_single_cumulative_entry()
788 .hists = evsel__hists(evsel), in iter_add_next_cumulative_entry()
985 static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, in hists__collapse_insert_entry()
1020 hists->nr_entries++; in hists__collapse_insert_entry()
1027 static struct rb_root *hists__get_rotate_entries_in(struct hists *hists) in hists__get_rotate_entries_in() argument
1031 pthread_mutex_lock(&hists->lock); in hists__get_rotate_entries_in()
1033 root = hists->entries_in; in hists__get_rotate_entries_in()
1034 if (++hists->entries_in > &hists->entries_in_array[1]) in hists__get_rotate_entries_in()
1035 hists->entries_in = &hists->entries_in_array[0]; in hists__get_rotate_entries_in()
1037 pthread_mutex_unlock(&hists->lock); in hists__get_rotate_entries_in()
1042 static void hists__apply_filters(struct hists *hists, struct hist_entry *he) in hists__apply_filters() argument
1044 hists__filter_entry_by_dso(hists, he); in hists__apply_filters()
1045 hists__filter_entry_by_thread(hists, he); in hists__apply_filters()
1046 hists__filter_entry_by_symbol(hists, he); in hists__apply_filters()
1047 hists__filter_entry_by_socket(hists, he); in hists__apply_filters()
1050 void hists__collapse_resort(struct hists *hists, struct ui_progress *prog) in hists__collapse_resort() argument
1059 hists->nr_entries = 0; in hists__collapse_resort()
1061 root = hists__get_rotate_entries_in(hists); in hists__collapse_resort()
1072 if (hists__collapse_insert_entry(hists, &hists->entries_collapsed, n)) { in hists__collapse_resort()
1078 hists__apply_filters(hists, n); in hists__collapse_resort()
1102 static void hists__reset_filter_stats(struct hists *hists) in hists__reset_filter_stats() argument
1104 hists->nr_non_filtered_entries = 0; in hists__reset_filter_stats()
1105 hists->stats.total_non_filtered_period = 0; in hists__reset_filter_stats()
1108 void hists__reset_stats(struct hists *hists) in hists__reset_stats() argument
1110 hists->nr_entries = 0; in hists__reset_stats()
1111 hists->stats.total_period = 0; in hists__reset_stats()
1113 hists__reset_filter_stats(hists); in hists__reset_stats()
1116 static void hists__inc_filter_stats(struct hists *hists, struct hist_entry *h) in hists__inc_filter_stats() argument
1118 hists->nr_non_filtered_entries++; in hists__inc_filter_stats()
1119 hists->stats.total_non_filtered_period += h->stat.period; in hists__inc_filter_stats()
1122 void hists__inc_stats(struct hists *hists, struct hist_entry *h) in hists__inc_stats() argument
1125 hists__inc_filter_stats(hists, h); in hists__inc_stats()
1127 hists->nr_entries++; in hists__inc_stats()
1128 hists->stats.total_period += h->stat.period; in hists__inc_stats()
1158 void hists__output_resort(struct hists *hists, struct ui_progress *prog) in hists__output_resort() argument
1164 struct perf_evsel *evsel = hists_to_evsel(hists); in hists__output_resort()
1172 min_callchain_hits = hists->stats.total_period * (callchain_param.min_percent / 100); in hists__output_resort()
1175 root = &hists->entries_collapsed; in hists__output_resort()
1177 root = hists->entries_in; in hists__output_resort()
1180 hists->entries = RB_ROOT; in hists__output_resort()
1182 hists__reset_stats(hists); in hists__output_resort()
1183 hists__reset_col_len(hists); in hists__output_resort()
1189 __hists__insert_output_entry(&hists->entries, n, min_callchain_hits, use_callchain); in hists__output_resort()
1190 hists__inc_stats(hists, n); in hists__output_resort()
1193 hists__calc_col_len(hists, n); in hists__output_resort()
1200 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h, in hists__remove_entry_filter() argument
1212 hists->stats.nr_non_filtered_samples += h->stat.nr_events; in hists__remove_entry_filter()
1214 hists__inc_filter_stats(hists, h); in hists__remove_entry_filter()
1215 hists__calc_col_len(hists, h); in hists__remove_entry_filter()
1219 static bool hists__filter_entry_by_dso(struct hists *hists, in hists__filter_entry_by_dso() argument
1222 if (hists->dso_filter != NULL && in hists__filter_entry_by_dso()
1223 (he->ms.map == NULL || he->ms.map->dso != hists->dso_filter)) { in hists__filter_entry_by_dso()
1231 void hists__filter_by_dso(struct hists *hists) in hists__filter_by_dso() argument
1235 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_dso()
1237 hists__reset_filter_stats(hists); in hists__filter_by_dso()
1238 hists__reset_col_len(hists); in hists__filter_by_dso()
1240 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_dso()
1246 if (hists__filter_entry_by_dso(hists, h)) in hists__filter_by_dso()
1249 hists__remove_entry_filter(hists, h, HIST_FILTER__DSO); in hists__filter_by_dso()
1253 static bool hists__filter_entry_by_thread(struct hists *hists, in hists__filter_entry_by_thread() argument
1256 if (hists->thread_filter != NULL && in hists__filter_entry_by_thread()
1257 he->thread != hists->thread_filter) { in hists__filter_entry_by_thread()
1265 void hists__filter_by_thread(struct hists *hists) in hists__filter_by_thread() argument
1269 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_thread()
1271 hists__reset_filter_stats(hists); in hists__filter_by_thread()
1272 hists__reset_col_len(hists); in hists__filter_by_thread()
1274 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_thread()
1277 if (hists__filter_entry_by_thread(hists, h)) in hists__filter_by_thread()
1280 hists__remove_entry_filter(hists, h, HIST_FILTER__THREAD); in hists__filter_by_thread()
1284 static bool hists__filter_entry_by_symbol(struct hists *hists, in hists__filter_entry_by_symbol() argument
1287 if (hists->symbol_filter_str != NULL && in hists__filter_entry_by_symbol()
1289 hists->symbol_filter_str) == NULL)) { in hists__filter_entry_by_symbol()
1297 void hists__filter_by_symbol(struct hists *hists) in hists__filter_by_symbol() argument
1301 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_symbol()
1303 hists__reset_filter_stats(hists); in hists__filter_by_symbol()
1304 hists__reset_col_len(hists); in hists__filter_by_symbol()
1306 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_symbol()
1309 if (hists__filter_entry_by_symbol(hists, h)) in hists__filter_by_symbol()
1312 hists__remove_entry_filter(hists, h, HIST_FILTER__SYMBOL); in hists__filter_by_symbol()
1316 static bool hists__filter_entry_by_socket(struct hists *hists, in hists__filter_entry_by_socket() argument
1319 if ((hists->socket_filter > -1) && in hists__filter_entry_by_socket()
1320 (he->socket != hists->socket_filter)) { in hists__filter_entry_by_socket()
1328 void hists__filter_by_socket(struct hists *hists) in hists__filter_by_socket() argument
1332 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_socket()
1334 hists__reset_filter_stats(hists); in hists__filter_by_socket()
1335 hists__reset_col_len(hists); in hists__filter_by_socket()
1337 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_socket()
1340 if (hists__filter_entry_by_socket(hists, h)) in hists__filter_by_socket()
1343 hists__remove_entry_filter(hists, h, HIST_FILTER__SOCKET); in hists__filter_by_socket()
1353 void hists__inc_nr_events(struct hists *hists, u32 type) in hists__inc_nr_events() argument
1355 events_stats__inc(&hists->stats, type); in hists__inc_nr_events()
1358 void hists__inc_nr_samples(struct hists *hists, bool filtered) in hists__inc_nr_samples() argument
1360 events_stats__inc(&hists->stats, PERF_RECORD_SAMPLE); in hists__inc_nr_samples()
1362 hists->stats.nr_non_filtered_samples++; in hists__inc_nr_samples()
1365 static struct hist_entry *hists__add_dummy_entry(struct hists *hists, in hists__add_dummy_entry() argument
1375 root = &hists->entries_collapsed; in hists__add_dummy_entry()
1377 root = hists->entries_in; in hists__add_dummy_entry()
1399 he->hists = hists; in hists__add_dummy_entry()
1402 hists__inc_stats(hists, he); in hists__add_dummy_entry()
1409 static struct hist_entry *hists__find_entry(struct hists *hists, in hists__find_entry() argument
1415 n = hists->entries_collapsed.rb_node; in hists__find_entry()
1417 n = hists->entries_in->rb_node; in hists__find_entry()
1437 void hists__match(struct hists *leader, struct hists *other) in hists__match()
1462 int hists__link(struct hists *leader, struct hists *other) in hists__link()
1535 u64 hists__total_period(struct hists *hists) in hists__total_period() argument
1537 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : in hists__total_period()
1538 hists->stats.total_period; in hists__total_period()
1564 struct hists *hists = evsel__hists(evsel); in hists_evsel__init() local
1566 memset(hists, 0, sizeof(*hists)); in hists_evsel__init()
1567 hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; in hists_evsel__init()
1568 hists->entries_in = &hists->entries_in_array[0]; in hists_evsel__init()
1569 hists->entries_collapsed = RB_ROOT; in hists_evsel__init()
1570 hists->entries = RB_ROOT; in hists_evsel__init()
1571 pthread_mutex_init(&hists->lock, NULL); in hists_evsel__init()
1572 hists->socket_filter = -1; in hists_evsel__init()