Lines Matching refs:he
22 struct hist_entry *he);
24 struct hist_entry *he);
26 struct hist_entry *he);
28 struct hist_entry *he);
274 static void hists__delete_entry(struct hists *hists, struct hist_entry *he);
276 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) in hists__decay_entry() argument
278 u64 prev_period = he->stat.period; in hists__decay_entry()
284 he_stat__decay(&he->stat); in hists__decay_entry()
286 he_stat__decay(he->stat_acc); in hists__decay_entry()
287 decay_callchain(he->callchain); in hists__decay_entry()
289 diff = prev_period - he->stat.period; in hists__decay_entry()
291 if (!he->depth) { in hists__decay_entry()
293 if (!he->filtered) in hists__decay_entry()
297 if (!he->leaf) { in hists__decay_entry()
299 struct rb_node *node = rb_first(&he->hroot_out); in hists__decay_entry()
309 return he->stat.period == 0; in hists__decay_entry()
312 static void hists__delete_entry(struct hists *hists, struct hist_entry *he) in hists__delete_entry() argument
317 if (he->parent_he) { in hists__delete_entry()
318 root_in = &he->parent_he->hroot_in; in hists__delete_entry()
319 root_out = &he->parent_he->hroot_out; in hists__delete_entry()
328 rb_erase(&he->rb_node_in, root_in); in hists__delete_entry()
329 rb_erase(&he->rb_node, root_out); in hists__delete_entry()
332 if (!he->filtered) in hists__delete_entry()
335 hist_entry__delete(he); in hists__delete_entry()
371 static int hist_entry__init(struct hist_entry *he, in hist_entry__init() argument
376 *he = *template; in hist_entry__init()
377 he->callchain_size = callchain_size; in hist_entry__init()
380 he->stat_acc = malloc(sizeof(he->stat)); in hist_entry__init()
381 if (he->stat_acc == NULL) in hist_entry__init()
383 memcpy(he->stat_acc, &he->stat, sizeof(he->stat)); in hist_entry__init()
385 memset(&he->stat, 0, sizeof(he->stat)); in hist_entry__init()
388 map__get(he->ms.map); in hist_entry__init()
390 if (he->branch_info) { in hist_entry__init()
396 he->branch_info = malloc(sizeof(*he->branch_info)); in hist_entry__init()
397 if (he->branch_info == NULL) { in hist_entry__init()
398 map__zput(he->ms.map); in hist_entry__init()
399 free(he->stat_acc); in hist_entry__init()
403 memcpy(he->branch_info, template->branch_info, in hist_entry__init()
404 sizeof(*he->branch_info)); in hist_entry__init()
406 map__get(he->branch_info->from.map); in hist_entry__init()
407 map__get(he->branch_info->to.map); in hist_entry__init()
410 if (he->mem_info) { in hist_entry__init()
411 map__get(he->mem_info->iaddr.map); in hist_entry__init()
412 map__get(he->mem_info->daddr.map); in hist_entry__init()
415 if (hist_entry__has_callchains(he) && symbol_conf.use_callchain) in hist_entry__init()
416 callchain_init(he->callchain); in hist_entry__init()
418 if (he->raw_data) { in hist_entry__init()
419 he->raw_data = memdup(he->raw_data, he->raw_size); in hist_entry__init()
421 if (he->raw_data == NULL) { in hist_entry__init()
422 map__put(he->ms.map); in hist_entry__init()
423 if (he->branch_info) { in hist_entry__init()
424 map__put(he->branch_info->from.map); in hist_entry__init()
425 map__put(he->branch_info->to.map); in hist_entry__init()
426 free(he->branch_info); in hist_entry__init()
428 if (he->mem_info) { in hist_entry__init()
429 map__put(he->mem_info->iaddr.map); in hist_entry__init()
430 map__put(he->mem_info->daddr.map); in hist_entry__init()
432 free(he->stat_acc); in hist_entry__init()
436 INIT_LIST_HEAD(&he->pairs.node); in hist_entry__init()
437 thread__get(he->thread); in hist_entry__init()
438 he->hroot_in = RB_ROOT; in hist_entry__init()
439 he->hroot_out = RB_ROOT; in hist_entry__init()
442 he->leaf = true; in hist_entry__init()
467 struct hist_entry *he; in hist_entry__new() local
476 he = ops->new(callchain_size); in hist_entry__new()
477 if (he) { in hist_entry__new()
478 err = hist_entry__init(he, template, sample_self, callchain_size); in hist_entry__new()
480 ops->free(he); in hist_entry__new()
481 he = NULL; in hist_entry__new()
485 return he; in hist_entry__new()
495 static void hist_entry__add_callchain_period(struct hist_entry *he, u64 period) in hist_entry__add_callchain_period() argument
497 if (!hist_entry__has_callchains(he) || !symbol_conf.use_callchain) in hist_entry__add_callchain_period()
500 he->hists->callchain_period += period; in hist_entry__add_callchain_period()
501 if (!he->filtered) in hist_entry__add_callchain_period()
502 he->hists->callchain_non_filtered_period += period; in hist_entry__add_callchain_period()
512 struct hist_entry *he; in hists__findnew_entry() local
521 he = rb_entry(parent, struct hist_entry, rb_node_in); in hists__findnew_entry()
529 cmp = hist_entry__cmp(he, entry); in hists__findnew_entry()
533 he_stat__add_period(&he->stat, period, weight); in hists__findnew_entry()
534 hist_entry__add_callchain_period(he, period); in hists__findnew_entry()
537 he_stat__add_period(he->stat_acc, period, weight); in hists__findnew_entry()
551 if (he->ms.map != entry->ms.map) { in hists__findnew_entry()
552 map__put(he->ms.map); in hists__findnew_entry()
553 he->ms.map = map__get(entry->ms.map); in hists__findnew_entry()
564 he = hist_entry__new(entry, sample_self); in hists__findnew_entry()
565 if (!he) in hists__findnew_entry()
569 hist_entry__add_callchain_period(he, period); in hists__findnew_entry()
572 rb_link_node(&he->rb_node_in, parent, p); in hists__findnew_entry()
573 rb_insert_color(&he->rb_node_in, hists->entries_in); in hists__findnew_entry()
576 he_stat__add_cpumode_period(&he->stat, al->cpumode, period); in hists__findnew_entry()
578 he_stat__add_cpumode_period(he->stat_acc, al->cpumode, period); in hists__findnew_entry()
579 return he; in hists__findnew_entry()
624 }, *he = hists__findnew_entry(hists, &entry, al, sample_self); in __hists__add_entry() local
626 if (!hists->has_callchains && he && he->callchain_size != 0) in __hists__add_entry()
628 return he; in __hists__add_entry()
691 struct hist_entry *he; in iter_add_single_mem_entry() local
709 he = hists__add_entry(hists, al, iter->parent, NULL, mi, in iter_add_single_mem_entry()
711 if (!he) in iter_add_single_mem_entry()
714 iter->he = he; in iter_add_single_mem_entry()
724 struct hist_entry *he = iter->he; in iter_finish_mem_entry() local
727 if (he == NULL) in iter_finish_mem_entry()
730 hists__inc_nr_samples(hists, he->filtered); in iter_finish_mem_entry()
732 err = hist_entry__append_callchain(he, iter->sample); in iter_finish_mem_entry()
742 iter->he = NULL; in iter_finish_mem_entry()
795 struct hist_entry *he = NULL; in iter_add_next_branch_entry() local
811 he = hists__add_entry(hists, al, iter->parent, &bi[i], NULL, in iter_add_next_branch_entry()
813 if (he == NULL) in iter_add_next_branch_entry()
816 hists__inc_nr_samples(hists, he->filtered); in iter_add_next_branch_entry()
819 iter->he = he; in iter_add_next_branch_entry()
829 iter->he = NULL; in iter_finish_branch_entry()
846 struct hist_entry *he; in iter_add_single_normal_entry() local
848 he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, in iter_add_single_normal_entry()
850 if (he == NULL) in iter_add_single_normal_entry()
853 iter->he = he; in iter_add_single_normal_entry()
861 struct hist_entry *he = iter->he; in iter_finish_normal_entry() local
865 if (he == NULL) in iter_finish_normal_entry()
868 iter->he = NULL; in iter_finish_normal_entry()
870 hists__inc_nr_samples(evsel__hists(evsel), he->filtered); in iter_finish_normal_entry()
872 return hist_entry__append_callchain(he, sample); in iter_finish_normal_entry()
906 struct hist_entry *he; in iter_add_single_cumulative_entry() local
909 he = hists__add_entry(hists, al, iter->parent, NULL, NULL, in iter_add_single_cumulative_entry()
911 if (he == NULL) in iter_add_single_cumulative_entry()
914 iter->he = he; in iter_add_single_cumulative_entry()
915 he_cache[iter->curr++] = he; in iter_add_single_cumulative_entry()
917 hist_entry__append_callchain(he, sample); in iter_add_single_cumulative_entry()
925 hists__inc_nr_samples(hists, he->filtered); in iter_add_single_cumulative_entry()
950 struct hist_entry *he; in iter_add_next_cumulative_entry() local
980 iter->he = NULL; in iter_add_next_cumulative_entry()
985 he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, in iter_add_next_cumulative_entry()
987 if (he == NULL) in iter_add_next_cumulative_entry()
990 iter->he = he; in iter_add_next_cumulative_entry()
991 he_cache[iter->curr++] = he; in iter_add_next_cumulative_entry()
993 if (hist_entry__has_callchains(he) && symbol_conf.use_callchain) in iter_add_next_cumulative_entry()
994 callchain_append(he->callchain, &cursor, sample->period); in iter_add_next_cumulative_entry()
1003 iter->he = NULL; in iter_finish_cumulative_entry()
1062 if (iter->he && iter->add_entry_cb) { in hist_entry_iter__add()
1073 if (iter->he && iter->add_entry_cb) { in hist_entry_iter__add()
1130 void hist_entry__delete(struct hist_entry *he) in hist_entry__delete() argument
1132 struct hist_entry_ops *ops = he->ops; in hist_entry__delete()
1134 thread__zput(he->thread); in hist_entry__delete()
1135 map__zput(he->ms.map); in hist_entry__delete()
1137 if (he->branch_info) { in hist_entry__delete()
1138 map__zput(he->branch_info->from.map); in hist_entry__delete()
1139 map__zput(he->branch_info->to.map); in hist_entry__delete()
1140 free_srcline(he->branch_info->srcline_from); in hist_entry__delete()
1141 free_srcline(he->branch_info->srcline_to); in hist_entry__delete()
1142 zfree(&he->branch_info); in hist_entry__delete()
1145 if (he->mem_info) { in hist_entry__delete()
1146 map__zput(he->mem_info->iaddr.map); in hist_entry__delete()
1147 map__zput(he->mem_info->daddr.map); in hist_entry__delete()
1148 mem_info__zput(he->mem_info); in hist_entry__delete()
1151 zfree(&he->stat_acc); in hist_entry__delete()
1152 free_srcline(he->srcline); in hist_entry__delete()
1153 if (he->srcfile && he->srcfile[0]) in hist_entry__delete()
1154 free(he->srcfile); in hist_entry__delete()
1155 free_callchain(he->callchain); in hist_entry__delete()
1156 free(he->trace_output); in hist_entry__delete()
1157 free(he->raw_data); in hist_entry__delete()
1158 ops->free(he); in hist_entry__delete()
1168 int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp, in hist_entry__snprintf_alignment() argument
1171 if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) { in hist_entry__snprintf_alignment()
1172 const int width = fmt->width(fmt, hpp, he->hists); in hist_entry__snprintf_alignment()
1186 static void hists__apply_filters(struct hists *hists, struct hist_entry *he);
1187 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *he,
1197 static void hist_entry__check_and_remove_filter(struct hist_entry *he, in hist_entry__check_and_remove_filter() argument
1203 struct hist_entry *parent = he->parent_he; in hist_entry__check_and_remove_filter()
1230 perf_hpp_list__for_each_format(he->hpp_list, fmt) { in hist_entry__check_and_remove_filter()
1244 if (!(he->filtered & (1 << type))) { in hist_entry__check_and_remove_filter()
1261 he->filtered |= (1 << type); in hist_entry__check_and_remove_filter()
1263 he->filtered |= (parent->filtered & (1 << type)); in hist_entry__check_and_remove_filter()
1267 static void hist_entry__apply_hierarchy_filters(struct hist_entry *he) in hist_entry__apply_hierarchy_filters() argument
1269 hist_entry__check_and_remove_filter(he, HIST_FILTER__THREAD, in hist_entry__apply_hierarchy_filters()
1272 hist_entry__check_and_remove_filter(he, HIST_FILTER__DSO, in hist_entry__apply_hierarchy_filters()
1275 hist_entry__check_and_remove_filter(he, HIST_FILTER__SYMBOL, in hist_entry__apply_hierarchy_filters()
1278 hists__apply_filters(he->hists, he); in hist_entry__apply_hierarchy_filters()
1283 struct hist_entry *he, in hierarchy_insert_entry() argument
1299 cmp = fmt->collapse(fmt, iter, he); in hierarchy_insert_entry()
1305 he_stat__add_stat(&iter->stat, &he->stat); in hierarchy_insert_entry()
1315 new = hist_entry__new(he, true); in hierarchy_insert_entry()
1330 he->trace_output = NULL; in hierarchy_insert_entry()
1335 he->srcline = NULL; in hierarchy_insert_entry()
1340 he->srcfile = NULL; in hierarchy_insert_entry()
1352 struct hist_entry *he) in hists__hierarchy_insert_entry() argument
1366 new_he = hierarchy_insert_entry(hists, root, he, parent, &node->hpp); in hists__hierarchy_insert_entry()
1385 he->callchain) < 0) in hists__hierarchy_insert_entry()
1391 hist_entry__delete(he); in hists__hierarchy_insert_entry()
1399 struct hist_entry *he) in hists__collapse_insert_entry() argument
1407 return hists__hierarchy_insert_entry(hists, root, he); in hists__collapse_insert_entry()
1413 cmp = hist_entry__collapse(iter, he); in hists__collapse_insert_entry()
1418 he_stat__add_stat(&iter->stat, &he->stat); in hists__collapse_insert_entry()
1420 he_stat__add_stat(iter->stat_acc, he->stat_acc); in hists__collapse_insert_entry()
1422 if (hist_entry__has_callchains(he) && symbol_conf.use_callchain) { in hists__collapse_insert_entry()
1426 he->callchain) < 0) in hists__collapse_insert_entry()
1429 hist_entry__delete(he); in hists__collapse_insert_entry()
1440 rb_link_node(&he->rb_node_in, parent, p); in hists__collapse_insert_entry()
1441 rb_insert_color(&he->rb_node_in, root); in hists__collapse_insert_entry()
1460 static void hists__apply_filters(struct hists *hists, struct hist_entry *he) in hists__apply_filters() argument
1462 hists__filter_entry_by_dso(hists, he); in hists__apply_filters()
1463 hists__filter_entry_by_thread(hists, he); in hists__apply_filters()
1464 hists__filter_entry_by_symbol(hists, he); in hists__apply_filters()
1465 hists__filter_entry_by_socket(hists, he); in hists__apply_filters()
1559 struct hist_entry *he; in hierarchy_recalc_total_periods() local
1572 he = rb_entry(node, struct hist_entry, rb_node); in hierarchy_recalc_total_periods()
1575 hists->stats.total_period += he->stat.period; in hierarchy_recalc_total_periods()
1576 if (!he->filtered) in hierarchy_recalc_total_periods()
1577 hists->stats.total_non_filtered_period += he->stat.period; in hierarchy_recalc_total_periods()
1582 struct hist_entry *he) in hierarchy_insert_output_entry() argument
1593 if (hist_entry__sort(he, iter) > 0) in hierarchy_insert_output_entry()
1599 rb_link_node(&he->rb_node, parent, p); in hierarchy_insert_output_entry()
1600 rb_insert_color(&he->rb_node, root); in hierarchy_insert_output_entry()
1603 perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { in hierarchy_insert_output_entry()
1605 fmt->sort(fmt, he, NULL); in hierarchy_insert_output_entry()
1617 struct hist_entry *he; in hists__hierarchy_output_resort() local
1623 he = rb_entry(node, struct hist_entry, rb_node_in); in hists__hierarchy_output_resort()
1626 hierarchy_insert_output_entry(root_out, he); in hists__hierarchy_output_resort()
1632 if (!he->filtered) { in hists__hierarchy_output_resort()
1634 hists__calc_col_len(hists, he); in hists__hierarchy_output_resort()
1637 if (!he->leaf) { in hists__hierarchy_output_resort()
1639 &he->hroot_in, in hists__hierarchy_output_resort()
1640 &he->hroot_out, in hists__hierarchy_output_resort()
1650 u64 total = he->stat.period; in hists__hierarchy_output_resort()
1653 total = he->stat_acc->period; in hists__hierarchy_output_resort()
1658 callchain_param.sort(&he->sorted_chain, he->callchain, in hists__hierarchy_output_resort()
1664 struct hist_entry *he, in __hists__insert_output_entry() argument
1675 u64 total = he->stat.period; in __hists__insert_output_entry()
1678 total = he->stat_acc->period; in __hists__insert_output_entry()
1682 callchain_param.sort(&he->sorted_chain, he->callchain, in __hists__insert_output_entry()
1690 if (hist_entry__sort(he, iter) > 0) in __hists__insert_output_entry()
1696 rb_link_node(&he->rb_node, parent, p); in __hists__insert_output_entry()
1697 rb_insert_color(&he->rb_node, entries); in __hists__insert_output_entry()
1701 perf_hpp__defined_dynamic_entry(fmt, he->hists)) in __hists__insert_output_entry()
1702 fmt->sort(fmt, he, NULL); /* update column width */ in __hists__insert_output_entry()
1785 static bool can_goto_child(struct hist_entry *he, enum hierarchy_move_dir hmd) in can_goto_child() argument
1787 if (he->leaf || hmd == HMD_FORCE_SIBLING) in can_goto_child()
1790 if (he->unfolded || hmd == HMD_FORCE_CHILD) in can_goto_child()
1798 struct hist_entry *he = rb_entry(node, struct hist_entry, rb_node); in rb_hierarchy_last() local
1800 while (can_goto_child(he, HMD_NORMAL)) { in rb_hierarchy_last()
1801 node = rb_last(&he->hroot_out); in rb_hierarchy_last()
1802 he = rb_entry(node, struct hist_entry, rb_node); in rb_hierarchy_last()
1809 struct hist_entry *he = rb_entry(node, struct hist_entry, rb_node); in __rb_hierarchy_next() local
1811 if (can_goto_child(he, hmd)) in __rb_hierarchy_next()
1812 node = rb_first(&he->hroot_out); in __rb_hierarchy_next()
1817 he = he->parent_he; in __rb_hierarchy_next()
1818 if (he == NULL) in __rb_hierarchy_next()
1821 node = rb_next(&he->rb_node); in __rb_hierarchy_next()
1828 struct hist_entry *he = rb_entry(node, struct hist_entry, rb_node); in rb_hierarchy_prev() local
1834 he = he->parent_he; in rb_hierarchy_prev()
1835 if (he == NULL) in rb_hierarchy_prev()
1838 return &he->rb_node; in rb_hierarchy_prev()
1841 bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit) in hist_entry__has_hierarchy_children() argument
1847 if (he->leaf) in hist_entry__has_hierarchy_children()
1850 node = rb_first(&he->hroot_out); in hist_entry__has_hierarchy_children()
1909 struct hist_entry *he) in hists__filter_entry_by_dso() argument
1912 (he->ms.map == NULL || he->ms.map->dso != hists->dso_filter)) { in hists__filter_entry_by_dso()
1913 he->filtered |= (1 << HIST_FILTER__DSO); in hists__filter_entry_by_dso()
1921 struct hist_entry *he) in hists__filter_entry_by_thread() argument
1924 he->thread != hists->thread_filter) { in hists__filter_entry_by_thread()
1925 he->filtered |= (1 << HIST_FILTER__THREAD); in hists__filter_entry_by_thread()
1933 struct hist_entry *he) in hists__filter_entry_by_symbol() argument
1936 (!he->ms.sym || strstr(he->ms.sym->name, in hists__filter_entry_by_symbol()
1938 he->filtered |= (1 << HIST_FILTER__SYMBOL); in hists__filter_entry_by_symbol()
1946 struct hist_entry *he) in hists__filter_entry_by_socket() argument
1949 (he->socket != hists->socket_filter)) { in hists__filter_entry_by_socket()
1950 he->filtered |= (1 << HIST_FILTER__SOCKET); in hists__filter_entry_by_socket()
1957 typedef bool (*filter_fn_t)(struct hists *hists, struct hist_entry *he);
1978 static void resort_filtered_entry(struct rb_root *root, struct hist_entry *he) in resort_filtered_entry() argument
1990 if (hist_entry__sort(he, iter) > 0) in resort_filtered_entry()
1996 rb_link_node(&he->rb_node, parent, p); in resort_filtered_entry()
1997 rb_insert_color(&he->rb_node, root); in resort_filtered_entry()
1999 if (he->leaf || he->filtered) in resort_filtered_entry()
2002 nd = rb_first(&he->hroot_out); in resort_filtered_entry()
2007 rb_erase(&h->rb_node, &he->hroot_out); in resort_filtered_entry()
2012 he->hroot_out = new_root; in resort_filtered_entry()
2146 struct hist_entry *he; in hists__add_dummy_entry() local
2158 he = rb_entry(parent, struct hist_entry, rb_node_in); in hists__add_dummy_entry()
2160 cmp = hist_entry__collapse(he, pair); in hists__add_dummy_entry()
2171 he = hist_entry__new(pair, true); in hists__add_dummy_entry()
2172 if (he) { in hists__add_dummy_entry()
2173 memset(&he->stat, 0, sizeof(he->stat)); in hists__add_dummy_entry()
2174 he->hists = hists; in hists__add_dummy_entry()
2176 memset(he->stat_acc, 0, sizeof(he->stat)); in hists__add_dummy_entry()
2177 rb_link_node(&he->rb_node_in, parent, p); in hists__add_dummy_entry()
2178 rb_insert_color(&he->rb_node_in, root); in hists__add_dummy_entry()
2179 hists__inc_stats(hists, he); in hists__add_dummy_entry()
2180 he->dummy = true; in hists__add_dummy_entry()
2183 return he; in hists__add_dummy_entry()
2192 struct hist_entry *he; in add_dummy_hierarchy_entry() local
2200 he = rb_entry(parent, struct hist_entry, rb_node_in); in add_dummy_hierarchy_entry()
2202 perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { in add_dummy_hierarchy_entry()
2203 cmp = fmt->collapse(fmt, he, pair); in add_dummy_hierarchy_entry()
2216 he = hist_entry__new(pair, true); in add_dummy_hierarchy_entry()
2217 if (he) { in add_dummy_hierarchy_entry()
2218 rb_link_node(&he->rb_node_in, parent, p); in add_dummy_hierarchy_entry()
2219 rb_insert_color(&he->rb_node_in, root); in add_dummy_hierarchy_entry()
2221 he->dummy = true; in add_dummy_hierarchy_entry()
2222 he->hists = hists; in add_dummy_hierarchy_entry()
2223 memset(&he->stat, 0, sizeof(he->stat)); in add_dummy_hierarchy_entry()
2224 hists__inc_stats(hists, he); in add_dummy_hierarchy_entry()
2227 return he; in add_dummy_hierarchy_entry()
2231 struct hist_entry *he) in hists__find_entry() argument
2242 int64_t cmp = hist_entry__collapse(iter, he); in hists__find_entry()
2256 struct hist_entry *he) in hists__find_hierarchy_entry() argument
2266 perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { in hists__find_hierarchy_entry()
2267 cmp = fmt->collapse(fmt, iter, he); in hists__find_hierarchy_entry()
2583 struct hist_entry *he; in hists__delete_remaining_entries() local
2589 he = rb_entry(node, struct hist_entry, rb_node_in); in hists__delete_remaining_entries()
2590 hist_entry__delete(he); in hists__delete_remaining_entries()