Lines Matching refs:hists

38 static bool hists__filter_entry_by_dso(struct hists *hists,
40 static bool hists__filter_entry_by_thread(struct hists *hists,
42 static bool hists__filter_entry_by_symbol(struct hists *hists,
44 static bool hists__filter_entry_by_socket(struct hists *hists,
46 static bool hists__filter_entry_by_parallelism(struct hists *hists,
49 u16 hists__col_len(struct hists *hists, enum hist_column col) in hists__col_len() argument
51 return hists->col_len[col]; in hists__col_len()
54 void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len) in hists__set_col_len() argument
56 hists->col_len[col] = len; in hists__set_col_len()
59 bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len) in hists__new_col_len() argument
61 if (len > hists__col_len(hists, col)) { in hists__new_col_len()
62 hists__set_col_len(hists, col, len); in hists__new_col_len()
68 void hists__reset_col_len(struct hists *hists) in hists__reset_col_len() argument
73 hists__set_col_len(hists, col, 0); in hists__reset_col_len()
76 static void hists__set_unres_dso_col_len(struct hists *hists, int dso) in hists__set_unres_dso_col_len() argument
80 if (hists__col_len(hists, dso) < unresolved_col_width && in hists__set_unres_dso_col_len()
83 hists__set_col_len(hists, dso, unresolved_col_width); in hists__set_unres_dso_col_len()
86 void hists__calc_col_len(struct hists *hists, struct hist_entry *h) in hists__calc_col_len() argument
103 hists__new_col_len(hists, HISTC_SYMBOL, symlen); in hists__calc_col_len()
106 hists__new_col_len(hists, HISTC_SYMBOL, symlen); in hists__calc_col_len()
107 hists__set_unres_dso_col_len(hists, HISTC_DSO); in hists__calc_col_len()
111 if (hists__new_col_len(hists, HISTC_COMM, len)) in hists__calc_col_len()
112 hists__set_col_len(hists, HISTC_THREAD, len + 8); in hists__calc_col_len()
116 hists__new_col_len(hists, HISTC_DSO, len); in hists__calc_col_len()
120 hists__new_col_len(hists, HISTC_PARENT, h->parent->namelen); in hists__calc_col_len()
127 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); in hists__calc_col_len()
130 hists__new_col_len(hists, HISTC_DSO_FROM, symlen); in hists__calc_col_len()
133 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen); in hists__calc_col_len()
134 hists__new_col_len(hists, HISTC_ADDR_FROM, symlen); in hists__calc_col_len()
135 hists__set_unres_dso_col_len(hists, HISTC_DSO_FROM); in hists__calc_col_len()
142 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); in hists__calc_col_len()
145 hists__new_col_len(hists, HISTC_DSO_TO, symlen); in hists__calc_col_len()
148 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen); in hists__calc_col_len()
149 hists__new_col_len(hists, HISTC_ADDR_TO, symlen); in hists__calc_col_len()
150 hists__set_unres_dso_col_len(hists, HISTC_DSO_TO); in hists__calc_col_len()
154 hists__new_col_len(hists, HISTC_SRCLINE_FROM, in hists__calc_col_len()
157 hists__new_col_len(hists, HISTC_SRCLINE_TO, in hists__calc_col_len()
165 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, in hists__calc_col_len()
167 hists__new_col_len(hists, HISTC_MEM_DCACHELINE, in hists__calc_col_len()
171 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, in hists__calc_col_len()
173 hists__new_col_len(hists, HISTC_MEM_DCACHELINE, in hists__calc_col_len()
180 hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, in hists__calc_col_len()
184 hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, in hists__calc_col_len()
190 hists__new_col_len(hists, HISTC_MEM_DADDR_DSO, in hists__calc_col_len()
194 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO); in hists__calc_col_len()
197 hists__new_col_len(hists, HISTC_MEM_PHYS_DADDR, in hists__calc_col_len()
200 hists__new_col_len(hists, HISTC_MEM_DATA_PAGE_SIZE, in hists__calc_col_len()
205 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen); in hists__calc_col_len()
206 hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, symlen); in hists__calc_col_len()
207 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO); in hists__calc_col_len()
210 hists__new_col_len(hists, HISTC_CGROUP, 6); in hists__calc_col_len()
211 hists__new_col_len(hists, HISTC_CGROUP_ID, 20); in hists__calc_col_len()
212 hists__new_col_len(hists, HISTC_PARALLELISM, 11); in hists__calc_col_len()
213 hists__new_col_len(hists, HISTC_CPU, 3); in hists__calc_col_len()
214 hists__new_col_len(hists, HISTC_SOCKET, 6); in hists__calc_col_len()
215 hists__new_col_len(hists, HISTC_MEM_LOCKED, 6); in hists__calc_col_len()
216 hists__new_col_len(hists, HISTC_MEM_TLB, 22); in hists__calc_col_len()
217 hists__new_col_len(hists, HISTC_MEM_SNOOP, 12); in hists__calc_col_len()
218 hists__new_col_len(hists, HISTC_MEM_LVL, 36 + 3); in hists__calc_col_len()
219 hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); in hists__calc_col_len()
220 hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); in hists__calc_col_len()
221 hists__new_col_len(hists, HISTC_MEM_BLOCKED, 10); in hists__calc_col_len()
222 hists__new_col_len(hists, HISTC_LOCAL_INS_LAT, 13); in hists__calc_col_len()
223 hists__new_col_len(hists, HISTC_GLOBAL_INS_LAT, 13); in hists__calc_col_len()
224 hists__new_col_len(hists, HISTC_LOCAL_P_STAGE_CYC, 13); in hists__calc_col_len()
225 hists__new_col_len(hists, HISTC_GLOBAL_P_STAGE_CYC, 13); in hists__calc_col_len()
226 hists__new_col_len(hists, HISTC_ADDR, BITS_PER_LONG / 4 + 2); in hists__calc_col_len()
227 hists__new_col_len(hists, HISTC_CALLCHAIN_BRANCH_PREDICTED, 9); in hists__calc_col_len()
228 hists__new_col_len(hists, HISTC_CALLCHAIN_BRANCH_ABORT, 5); in hists__calc_col_len()
229 hists__new_col_len(hists, HISTC_CALLCHAIN_BRANCH_CYCLES, 6); in hists__calc_col_len()
232 hists__new_col_len(hists, HISTC_TIME, 16); in hists__calc_col_len()
234 hists__new_col_len(hists, HISTC_TIME, 12); in hists__calc_col_len()
235 hists__new_col_len(hists, HISTC_CODE_PAGE_SIZE, 6); in hists__calc_col_len()
239 hists__new_col_len(hists, HISTC_SRCLINE, len); in hists__calc_col_len()
243 hists__new_col_len(hists, HISTC_SRCFILE, strlen(h->srcfile)); in hists__calc_col_len()
246 hists__new_col_len(hists, HISTC_TRANSACTION, in hists__calc_col_len()
250 hists__new_col_len(hists, HISTC_TRACE, strlen(h->trace_output)); in hists__calc_col_len()
259 hists__new_col_len(hists, HISTC_CGROUP, strlen(cgrp_name)); in hists__calc_col_len()
263 void hists__output_recalc_col_len(struct hists *hists, int max_rows) in hists__output_recalc_col_len() argument
265 struct rb_node *next = rb_first_cached(&hists->entries); in hists__output_recalc_col_len()
269 hists__reset_col_len(hists); in hists__output_recalc_col_len()
274 hists__calc_col_len(hists, n); in hists__output_recalc_col_len()
339 static int hists__update_mem_stat(struct hists *hists, struct hist_entry *he, in hists__update_mem_stat() argument
342 if (hists->nr_mem_stats == 0) in hists__update_mem_stat()
346 he->mem_stat = calloc(hists->nr_mem_stats, sizeof(*he->mem_stat)); in hists__update_mem_stat()
351 for (int i = 0; i < hists->nr_mem_stats; i++) { in hists__update_mem_stat()
352 int idx = mem_stat_index(hists->mem_stat_types[i], in hists__update_mem_stat()
357 hists->mem_stat_total[i].entries[idx] += period; in hists__update_mem_stat()
362 static void hists__add_mem_stat(struct hists *hists, struct hist_entry *dst, in hists__add_mem_stat() argument
365 if (hists->nr_mem_stats == 0) in hists__add_mem_stat()
368 for (int i = 0; i < hists->nr_mem_stats; i++) { in hists__add_mem_stat()
374 static int hists__clone_mem_stat(struct hists *hists, struct hist_entry *dst, in hists__clone_mem_stat() argument
377 if (hists->nr_mem_stats == 0) in hists__clone_mem_stat()
380 dst->mem_stat = calloc(hists->nr_mem_stats, sizeof(*dst->mem_stat)); in hists__clone_mem_stat()
384 for (int i = 0; i < hists->nr_mem_stats; i++) { in hists__clone_mem_stat()
391 static void hists__decay_mem_stat(struct hists *hists, struct hist_entry *he) in hists__decay_mem_stat() argument
393 if (hists->nr_mem_stats == 0) in hists__decay_mem_stat()
396 for (int i = 0; i < hists->nr_mem_stats; i++) { in hists__decay_mem_stat()
402 static void hists__delete_entry(struct hists *hists, struct hist_entry *he);
404 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) in hists__decay_entry() argument
416 hists__decay_mem_stat(hists, he); in hists__decay_entry()
422 hists->stats.total_period -= period_diff; in hists__decay_entry()
423 hists->stats.total_latency -= latency_diff; in hists__decay_entry()
425 hists->stats.total_non_filtered_period -= period_diff; in hists__decay_entry()
426 hists->stats.total_non_filtered_latency -= latency_diff; in hists__decay_entry()
437 if (hists__decay_entry(hists, child)) in hists__decay_entry()
438 hists__delete_entry(hists, child); in hists__decay_entry()
445 static void hists__delete_entry(struct hists *hists, struct hist_entry *he) in hists__delete_entry() argument
454 if (hists__has(hists, need_collapse)) in hists__delete_entry()
455 root_in = &hists->entries_collapsed; in hists__delete_entry()
457 root_in = hists->entries_in; in hists__delete_entry()
458 root_out = &hists->entries; in hists__delete_entry()
464 --hists->nr_entries; in hists__delete_entry()
466 --hists->nr_non_filtered_entries; in hists__delete_entry()
471 void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel) in hists__decay_entries() argument
473 struct rb_node *next = rb_first_cached(&hists->entries); in hists__decay_entries()
481 hists__decay_entry(hists, n))) { in hists__decay_entries()
482 hists__delete_entry(hists, n); in hists__decay_entries()
487 void hists__delete_entries(struct hists *hists) in hists__delete_entries() argument
489 struct rb_node *next = rb_first_cached(&hists->entries); in hists__delete_entries()
496 hists__delete_entry(hists, n); in hists__delete_entries()
500 struct hist_entry *hists__get_entry(struct hists *hists, int idx) in hists__get_entry() argument
502 struct rb_node *next = rb_first_cached(&hists->entries); in hists__get_entry()
673 he->hists->callchain_period += period; in hist_entry__add_callchain_period()
674 he->hists->callchain_latency += latency; in hist_entry__add_callchain_period()
676 he->hists->callchain_non_filtered_period += period; in hist_entry__add_callchain_period()
677 he->hists->callchain_non_filtered_latency += latency; in hist_entry__add_callchain_period()
681 static struct hist_entry *hists__findnew_entry(struct hists *hists, in hists__findnew_entry() argument
694 p = &hists->entries_in->rb_root.rb_node; in hists__findnew_entry()
725 if (hists__has(hists, sym) && he->ms.map != entry->ms.map) { in hists__findnew_entry()
751 hists->nr_entries++; in hists__findnew_entry()
754 rb_insert_color_cached(&he->rb_node_in, hists->entries_in, leftmost); in hists__findnew_entry()
760 if (hists__update_mem_stat(hists, he, entry->mem_info, period) < 0) { in hists__findnew_entry()
794 __hists__add_entry(struct hists *hists, in __hists__add_entry() argument
837 .hists = hists, in __hists__add_entry()
851 }, *he = hists__findnew_entry(hists, &entry, al, sample_self); in __hists__add_entry()
853 if (!hists->has_callchains && he && he->callchain_size != 0) in __hists__add_entry()
854 hists->has_callchains = true; in __hists__add_entry()
860 struct hist_entry *hists__add_entry(struct hists *hists, in hists__add_entry() argument
869 return __hists__add_entry(hists, al, sym_parent, bi, mi, ki, NULL, in hists__add_entry()
873 struct hist_entry *hists__add_entry_ops(struct hists *hists, in hists__add_entry_ops() argument
883 return __hists__add_entry(hists, al, sym_parent, bi, mi, ki, NULL, in hists__add_entry_ops()
887 struct hist_entry *hists__add_entry_block(struct hists *hists, in hists__add_entry_block() argument
893 .hists = hists, in hists__add_entry_block()
899 }, *he = hists__findnew_entry(hists, &entry, al, false); in hists__add_entry_block()
937 struct hists *hists = evsel__hists(iter->evsel); in iter_add_single_mem_entry() local
957 he = hists__add_entry(hists, al, iter->parent, NULL, mi, NULL, in iter_add_single_mem_entry()
971 struct hists *hists = evsel__hists(evsel); in iter_finish_mem_entry() local
978 hists__inc_nr_samples(hists, he->filtered); in iter_finish_mem_entry()
1039 struct hists *hists = evsel__hists(evsel); in iter_add_next_branch_entry() local
1057 he = hists__add_entry(hists, al, iter->parent, &bi[i], NULL, NULL, in iter_add_next_branch_entry()
1081 struct hists *hists = evsel__hists(evsel); in iter_finish_branch_entry() local
1087 hists__inc_nr_samples(hists, iter->he->filtered); in iter_finish_branch_entry()
1168 struct hists *hists = evsel__hists(evsel); in iter_add_single_cumulative_entry() local
1174 he = hists__add_entry(hists, al, iter->parent, NULL, NULL, NULL, in iter_add_single_cumulative_entry()
1190 hists__inc_nr_samples(hists, he->filtered); in iter_add_single_cumulative_entry()
1231 .hists = evsel__hists(evsel), in iter_add_next_cumulative_entry()
1248 bool fast = hists__has(he_tmp.hists, sym); in iter_add_next_cumulative_entry()
1391 struct hists *hists = left->hists; in hist_entry__cmp_impl() local
1407 !perf_hpp__defined_dynamic_entry(fmt, hists)) in hist_entry__cmp_impl()
1410 if (ignore_skipped && perf_hpp__should_skip(fmt, hists)) in hist_entry__cmp_impl()
1425 return hist_entry__cmp_impl(left->hists->hpp_list, left, right, in hist_entry__cmp()
1432 return hist_entry__cmp_impl(left->hists->hpp_list, left, right, in hist_entry__sort()
1439 return hist_entry__cmp_impl(left->hists->hpp_list, left, right, in hist_entry__collapse()
1508 if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) { in hist_entry__snprintf_alignment()
1509 const int width = fmt->width(fmt, hpp, he->hists); in hist_entry__snprintf_alignment()
1523 static void hists__apply_filters(struct hists *hists, struct hist_entry *he);
1524 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *he,
1622 hists__apply_filters(he->hists, he); in hist_entry__apply_hierarchy_filters()
1625 static struct hist_entry *hierarchy_insert_entry(struct hists *hists, in hierarchy_insert_entry() argument
1644 hists__add_mem_stat(hists, iter, he); in hierarchy_insert_entry()
1660 hists->nr_entries++; in hierarchy_insert_entry()
1686 if (hists__clone_mem_stat(hists, new, he) < 0) { in hierarchy_insert_entry()
1696 static int hists__hierarchy_insert_entry(struct hists *hists, in hists__hierarchy_insert_entry() argument
1706 list_for_each_entry(node, &hists->hpp_formats, list) { in hists__hierarchy_insert_entry()
1712 new_he = hierarchy_insert_entry(hists, root, he, parent, &node->hpp); in hists__hierarchy_insert_entry()
1748 static int hists__collapse_insert_entry(struct hists *hists, in hists__collapse_insert_entry() argument
1759 return hists__hierarchy_insert_entry(hists, root, he); in hists__collapse_insert_entry()
1773 hists__add_mem_stat(hists, iter, he); in hists__collapse_insert_entry()
1797 hists->nr_entries++; in hists__collapse_insert_entry()
1804 struct rb_root_cached *hists__get_rotate_entries_in(struct hists *hists) in hists__get_rotate_entries_in() argument
1808 mutex_lock(&hists->lock); in hists__get_rotate_entries_in()
1810 root = hists->entries_in; in hists__get_rotate_entries_in()
1811 if (++hists->entries_in > &hists->entries_in_array[1]) in hists__get_rotate_entries_in()
1812 hists->entries_in = &hists->entries_in_array[0]; in hists__get_rotate_entries_in()
1814 mutex_unlock(&hists->lock); in hists__get_rotate_entries_in()
1819 static void hists__apply_filters(struct hists *hists, struct hist_entry *he) in hists__apply_filters() argument
1821 hists__filter_entry_by_dso(hists, he); in hists__apply_filters()
1822 hists__filter_entry_by_thread(hists, he); in hists__apply_filters()
1823 hists__filter_entry_by_symbol(hists, he); in hists__apply_filters()
1824 hists__filter_entry_by_socket(hists, he); in hists__apply_filters()
1825 hists__filter_entry_by_parallelism(hists, he); in hists__apply_filters()
1828 int hists__collapse_resort(struct hists *hists, struct ui_progress *prog) in hists__collapse_resort() argument
1835 if (!hists__has(hists, need_collapse)) in hists__collapse_resort()
1838 hists->nr_entries = 0; in hists__collapse_resort()
1840 root = hists__get_rotate_entries_in(hists); in hists__collapse_resort()
1851 ret = hists__collapse_insert_entry(hists, &hists->entries_collapsed, n); in hists__collapse_resort()
1861 hists__apply_filters(hists, n); in hists__collapse_resort()
1869 static void hists__reset_filter_stats(struct hists *hists) in hists__reset_filter_stats() argument
1871 hists->nr_non_filtered_entries = 0; in hists__reset_filter_stats()
1872 hists->stats.total_non_filtered_period = 0; in hists__reset_filter_stats()
1873 hists->stats.total_non_filtered_latency = 0; in hists__reset_filter_stats()
1876 void hists__reset_stats(struct hists *hists) in hists__reset_stats() argument
1878 hists->nr_entries = 0; in hists__reset_stats()
1879 hists->stats.total_period = 0; in hists__reset_stats()
1880 hists->stats.total_latency = 0; in hists__reset_stats()
1882 hists__reset_filter_stats(hists); in hists__reset_stats()
1885 static void hists__inc_filter_stats(struct hists *hists, struct hist_entry *h) in hists__inc_filter_stats() argument
1887 hists->nr_non_filtered_entries++; in hists__inc_filter_stats()
1888 hists->stats.total_non_filtered_period += h->stat.period; in hists__inc_filter_stats()
1889 hists->stats.total_non_filtered_latency += h->stat.latency; in hists__inc_filter_stats()
1892 void hists__inc_stats(struct hists *hists, struct hist_entry *h) in hists__inc_stats() argument
1895 hists__inc_filter_stats(hists, h); in hists__inc_stats()
1897 hists->nr_entries++; in hists__inc_stats()
1898 hists->stats.total_period += h->stat.period; in hists__inc_stats()
1899 hists->stats.total_latency += h->stat.latency; in hists__inc_stats()
1902 static void hierarchy_recalc_total_periods(struct hists *hists) in hierarchy_recalc_total_periods() argument
1907 node = rb_first_cached(&hists->entries); in hierarchy_recalc_total_periods()
1909 hists->stats.total_period = 0; in hierarchy_recalc_total_periods()
1910 hists->stats.total_non_filtered_period = 0; in hierarchy_recalc_total_periods()
1911 hists->stats.total_latency = 0; in hierarchy_recalc_total_periods()
1912 hists->stats.total_non_filtered_latency = 0; in hierarchy_recalc_total_periods()
1923 hists->stats.total_period += he->stat.period; in hierarchy_recalc_total_periods()
1924 hists->stats.total_latency += he->stat.latency; in hierarchy_recalc_total_periods()
1926 hists->stats.total_non_filtered_period += he->stat.period; in hierarchy_recalc_total_periods()
1927 hists->stats.total_non_filtered_latency += he->stat.latency; in hierarchy_recalc_total_periods()
1963 static void hists__hierarchy_output_resort(struct hists *hists, in hists__hierarchy_output_resort() argument
1985 hists->nr_entries++; in hists__hierarchy_output_resort()
1987 hists->nr_non_filtered_entries++; in hists__hierarchy_output_resort()
1988 hists__calc_col_len(hists, he); in hists__hierarchy_output_resort()
1992 hists__hierarchy_output_resort(hists, prog, in hists__hierarchy_output_resort()
2063 static void output_resort(struct hists *hists, struct ui_progress *prog, in output_resort() argument
2073 callchain_total = hists->callchain_period; in output_resort()
2075 callchain_total = hists->callchain_non_filtered_period; in output_resort()
2079 hists__reset_stats(hists); in output_resort()
2080 hists__reset_col_len(hists); in output_resort()
2083 hists__hierarchy_output_resort(hists, prog, in output_resort()
2084 &hists->entries_collapsed, in output_resort()
2085 &hists->entries, in output_resort()
2088 hierarchy_recalc_total_periods(hists); in output_resort()
2092 if (hists__has(hists, need_collapse)) in output_resort()
2093 root = &hists->entries_collapsed; in output_resort()
2095 root = hists->entries_in; in output_resort()
2098 hists->entries = RB_ROOT_CACHED; in output_resort()
2107 __hists__insert_output_entry(&hists->entries, n, min_callchain_hits, use_callchain); in output_resort()
2108 hists__inc_stats(hists, n); in output_resort()
2111 hists__calc_col_len(hists, n); in output_resort()
2138 void hists__output_resort(struct hists *hists, struct ui_progress *prog) in hists__output_resort() argument
2140 output_resort(hists, prog, symbol_conf.use_callchain, NULL, NULL); in hists__output_resort()
2143 void hists__output_resort_cb(struct hists *hists, struct ui_progress *prog, in hists__output_resort_cb() argument
2146 output_resort(hists, prog, symbol_conf.use_callchain, cb, NULL); in hists__output_resort_cb()
2230 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h, in hists__remove_entry_filter() argument
2265 hists->stats.nr_non_filtered_samples += h->stat.nr_events; in hists__remove_entry_filter()
2267 hists__inc_filter_stats(hists, h); in hists__remove_entry_filter()
2268 hists__calc_col_len(hists, h); in hists__remove_entry_filter()
2272 static bool hists__filter_entry_by_dso(struct hists *hists, in hists__filter_entry_by_dso() argument
2275 if (hists->dso_filter != NULL && in hists__filter_entry_by_dso()
2276 (he->ms.map == NULL || !RC_CHK_EQUAL(map__dso(he->ms.map), hists->dso_filter))) { in hists__filter_entry_by_dso()
2284 static bool hists__filter_entry_by_thread(struct hists *hists, in hists__filter_entry_by_thread() argument
2287 if (hists->thread_filter != NULL && in hists__filter_entry_by_thread()
2288 !RC_CHK_EQUAL(he->thread, hists->thread_filter)) { in hists__filter_entry_by_thread()
2296 static bool hists__filter_entry_by_symbol(struct hists *hists, in hists__filter_entry_by_symbol() argument
2299 if (hists->symbol_filter_str != NULL && in hists__filter_entry_by_symbol()
2301 hists->symbol_filter_str) == NULL)) { in hists__filter_entry_by_symbol()
2309 static bool hists__filter_entry_by_socket(struct hists *hists, in hists__filter_entry_by_socket() argument
2312 if ((hists->socket_filter > -1) && in hists__filter_entry_by_socket()
2313 (he->socket != hists->socket_filter)) { in hists__filter_entry_by_socket()
2321 static bool hists__filter_entry_by_parallelism(struct hists *hists, in hists__filter_entry_by_parallelism() argument
2324 if (test_bit(he->parallelism, hists->parallelism_filter)) { in hists__filter_entry_by_parallelism()
2331 typedef bool (*filter_fn_t)(struct hists *hists, struct hist_entry *he);
2333 static void hists__filter_by_type(struct hists *hists, int type, filter_fn_t filter) in hists__filter_by_type() argument
2337 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_type()
2339 hists__reset_filter_stats(hists); in hists__filter_by_type()
2340 hists__reset_col_len(hists); in hists__filter_by_type()
2342 for (nd = rb_first_cached(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_type()
2345 if (filter(hists, h)) in hists__filter_by_type()
2348 hists__remove_entry_filter(hists, h, type); in hists__filter_by_type()
2393 static void hists__filter_hierarchy(struct hists *hists, int type, const void *arg) in hists__filter_hierarchy() argument
2398 hists->stats.nr_non_filtered_samples = 0; in hists__filter_hierarchy()
2400 hists__reset_filter_stats(hists); in hists__filter_hierarchy()
2401 hists__reset_col_len(hists); in hists__filter_hierarchy()
2403 nd = rb_first_cached(&hists->entries); in hists__filter_hierarchy()
2435 hists__remove_entry_filter(hists, h, type); in hists__filter_hierarchy()
2441 hierarchy_recalc_total_periods(hists); in hists__filter_hierarchy()
2447 nd = rb_first_cached(&hists->entries); in hists__filter_hierarchy()
2452 rb_erase_cached(&h->rb_node, &hists->entries); in hists__filter_hierarchy()
2457 hists->entries = new_root; in hists__filter_hierarchy()
2460 void hists__filter_by_thread(struct hists *hists) in hists__filter_by_thread() argument
2463 hists__filter_hierarchy(hists, HIST_FILTER__THREAD, in hists__filter_by_thread()
2464 hists->thread_filter); in hists__filter_by_thread()
2466 hists__filter_by_type(hists, HIST_FILTER__THREAD, in hists__filter_by_thread()
2470 void hists__filter_by_dso(struct hists *hists) in hists__filter_by_dso() argument
2473 hists__filter_hierarchy(hists, HIST_FILTER__DSO, in hists__filter_by_dso()
2474 hists->dso_filter); in hists__filter_by_dso()
2476 hists__filter_by_type(hists, HIST_FILTER__DSO, in hists__filter_by_dso()
2480 void hists__filter_by_symbol(struct hists *hists) in hists__filter_by_symbol() argument
2483 hists__filter_hierarchy(hists, HIST_FILTER__SYMBOL, in hists__filter_by_symbol()
2484 hists->symbol_filter_str); in hists__filter_by_symbol()
2486 hists__filter_by_type(hists, HIST_FILTER__SYMBOL, in hists__filter_by_symbol()
2490 void hists__filter_by_socket(struct hists *hists) in hists__filter_by_socket() argument
2493 hists__filter_hierarchy(hists, HIST_FILTER__SOCKET, in hists__filter_by_socket()
2494 &hists->socket_filter); in hists__filter_by_socket()
2496 hists__filter_by_type(hists, HIST_FILTER__SOCKET, in hists__filter_by_socket()
2500 void hists__filter_by_parallelism(struct hists *hists) in hists__filter_by_parallelism() argument
2503 hists__filter_hierarchy(hists, HIST_FILTER__PARALLELISM, in hists__filter_by_parallelism()
2504 hists->parallelism_filter); in hists__filter_by_parallelism()
2506 hists__filter_by_type(hists, HIST_FILTER__PARALLELISM, in hists__filter_by_parallelism()
2521 void hists__inc_nr_events(struct hists *hists) in hists__inc_nr_events() argument
2523 hists_stats__inc(&hists->stats); in hists__inc_nr_events()
2526 void hists__inc_nr_samples(struct hists *hists, bool filtered) in hists__inc_nr_samples() argument
2528 hists_stats__inc(&hists->stats); in hists__inc_nr_samples()
2530 hists->stats.nr_non_filtered_samples++; in hists__inc_nr_samples()
2533 void hists__inc_nr_lost_samples(struct hists *hists, u32 lost) in hists__inc_nr_lost_samples() argument
2535 hists->stats.nr_lost_samples += lost; in hists__inc_nr_lost_samples()
2538 void hists__inc_nr_dropped_samples(struct hists *hists, u32 lost) in hists__inc_nr_dropped_samples() argument
2540 hists->stats.nr_dropped_samples += lost; in hists__inc_nr_dropped_samples()
2543 static struct hist_entry *hists__add_dummy_entry(struct hists *hists, in hists__add_dummy_entry() argument
2553 if (hists__has(hists, need_collapse)) in hists__add_dummy_entry()
2554 root = &hists->entries_collapsed; in hists__add_dummy_entry()
2556 root = hists->entries_in; in hists__add_dummy_entry()
2580 he->hists = hists; in hists__add_dummy_entry()
2585 hists__inc_stats(hists, he); in hists__add_dummy_entry()
2592 static struct hist_entry *add_dummy_hierarchy_entry(struct hists *hists, in add_dummy_hierarchy_entry() argument
2625 he->hists = hists; in add_dummy_hierarchy_entry()
2627 hists__inc_stats(hists, he); in add_dummy_hierarchy_entry()
2633 static struct hist_entry *hists__find_entry(struct hists *hists, in hists__find_entry() argument
2638 if (hists__has(hists, need_collapse)) in hists__find_entry()
2639 n = hists->entries_collapsed.rb_root.rb_node; in hists__find_entry()
2641 n = hists->entries_in->rb_root.rb_node; in hists__find_entry()
2700 void hists__match(struct hists *leader, struct hists *other) in hists__match()
2726 static int hists__link_hierarchy(struct hists *leader_hists, in hists__link_hierarchy()
2741 if (leader->hists == leader_hists) { in hists__link_hierarchy()
2775 int hists__link(struct hists *leader, struct hists *other) in hists__link()
2807 int hists__unlink(struct hists *hists) in hists__unlink() argument
2813 if (hists__has(hists, need_collapse)) in hists__unlink()
2814 root = &hists->entries_collapsed; in hists__unlink()
2816 root = hists->entries_in; in hists__unlink()
2874 struct hists *hists = evsel__hists(pos); in evlist__fprintf_nr_events() local
2875 u64 total_samples = hists->stats.nr_samples; in evlist__fprintf_nr_events()
2877 total_samples += hists->stats.nr_lost_samples; in evlist__fprintf_nr_events()
2878 total_samples += hists->stats.nr_dropped_samples; in evlist__fprintf_nr_events()
2884 if (hists->stats.nr_samples) in evlist__fprintf_nr_events()
2886 "SAMPLE", hists->stats.nr_samples); in evlist__fprintf_nr_events()
2887 if (hists->stats.nr_lost_samples) in evlist__fprintf_nr_events()
2889 "LOST_SAMPLES", hists->stats.nr_lost_samples); in evlist__fprintf_nr_events()
2890 if (hists->stats.nr_dropped_samples) in evlist__fprintf_nr_events()
2892 "LOST_SAMPLES (BPF)", hists->stats.nr_dropped_samples); in evlist__fprintf_nr_events()
2899 u64 hists__total_period(struct hists *hists) in hists__total_period() argument
2901 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : in hists__total_period()
2902 hists->stats.total_period; in hists__total_period()
2905 u64 hists__total_latency(struct hists *hists) in hists__total_latency() argument
2907 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_latency : in hists__total_latency()
2908 hists->stats.total_latency; in hists__total_latency()
2911 int __hists__scnprintf_title(struct hists *hists, char *bf, size_t size, bool show_freq) in __hists__scnprintf_title() argument
2915 const struct dso *dso = hists->dso_filter; in __hists__scnprintf_title()
2916 struct thread *thread = hists->thread_filter; in __hists__scnprintf_title()
2917 int socket_id = hists->socket_filter; in __hists__scnprintf_title()
2918 unsigned long nr_samples = hists->stats.nr_samples; in __hists__scnprintf_title()
2919 u64 nr_events = hists->stats.total_period; in __hists__scnprintf_title()
2920 struct evsel *evsel = hists_to_evsel(hists); in __hists__scnprintf_title()
2928 nr_samples = hists->stats.nr_non_filtered_samples; in __hists__scnprintf_title()
2929 nr_events = hists->stats.total_non_filtered_period; in __hists__scnprintf_title()
2939 struct hists *pos_hists = evsel__hists(pos); in __hists__scnprintf_title()
2965 if (hists->uid_filter_str) in __hists__scnprintf_title()
2967 ", UID: %s", hists->uid_filter_str); in __hists__scnprintf_title()
2969 if (hists__has(hists, thread)) { in __hists__scnprintf_title()
3013 int __hists__init(struct hists *hists, struct perf_hpp_list *hpp_list) in __hists__init() argument
3015 memset(hists, 0, sizeof(*hists)); in __hists__init()
3016 hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT_CACHED; in __hists__init()
3017 hists->entries_in = &hists->entries_in_array[0]; in __hists__init()
3018 hists->entries_collapsed = RB_ROOT_CACHED; in __hists__init()
3019 hists->entries = RB_ROOT_CACHED; in __hists__init()
3020 mutex_init(&hists->lock); in __hists__init()
3021 hists->socket_filter = -1; in __hists__init()
3022 hists->parallelism_filter = symbol_conf.parallelism_filter; in __hists__init()
3023 hists->hpp_list = hpp_list; in __hists__init()
3024 INIT_LIST_HEAD(&hists->hpp_formats); in __hists__init()
3042 static void hists__delete_all_entries(struct hists *hists) in hists__delete_all_entries() argument
3044 hists__delete_entries(hists); in hists__delete_all_entries()
3045 hists__delete_remaining_entries(&hists->entries_in_array[0]); in hists__delete_all_entries()
3046 hists__delete_remaining_entries(&hists->entries_in_array[1]); in hists__delete_all_entries()
3047 hists__delete_remaining_entries(&hists->entries_collapsed); in hists__delete_all_entries()
3052 struct hists *hists = evsel__hists(evsel); in hists_evsel__exit() local
3056 hists__delete_all_entries(hists); in hists_evsel__exit()
3057 zfree(&hists->mem_stat_types); in hists_evsel__exit()
3058 zfree(&hists->mem_stat_total); in hists_evsel__exit()
3060 list_for_each_entry_safe(node, tmp, &hists->hpp_formats, list) { in hists_evsel__exit()
3072 struct hists *hists = evsel__hists(evsel); in hists_evsel__init() local
3074 __hists__init(hists, &perf_hpp_list); in hists_evsel__init()