Lines Matching +full:entry +full:- +full:latency
1 // SPDX-License-Identifier: GPL-2.0
5 #include "build-id.h"
7 #include "kvm-stat.h"
11 #include "mem-events.h"
12 #include "mem-info.h"
24 #include "block-info.h"
51 return hists->col_len[col]; in hists__col_len()
56 hists->col_len[col] = len; in hists__set_col_len()
92 if (h->block_info) in hists__calc_col_len()
99 if (h->ms.sym) { in hists__calc_col_len()
100 symlen = h->ms.sym->namelen + 4; in hists__calc_col_len()
110 len = thread__comm_len(h->thread); in hists__calc_col_len()
114 if (h->ms.map) { in hists__calc_col_len()
115 len = dso__name_len(map__dso(h->ms.map)); in hists__calc_col_len()
119 if (h->parent) in hists__calc_col_len()
120 hists__new_col_len(hists, HISTC_PARENT, h->parent->namelen); in hists__calc_col_len()
122 if (h->branch_info) { in hists__calc_col_len()
123 if (h->branch_info->from.ms.sym) { in hists__calc_col_len()
124 symlen = (int)h->branch_info->from.ms.sym->namelen + 4; in hists__calc_col_len()
129 symlen = dso__name_len(map__dso(h->branch_info->from.ms.map)); in hists__calc_col_len()
138 if (h->branch_info->to.ms.sym) { in hists__calc_col_len()
139 symlen = (int)h->branch_info->to.ms.sym->namelen + 4; in hists__calc_col_len()
144 symlen = dso__name_len(map__dso(h->branch_info->to.ms.map)); in hists__calc_col_len()
153 if (h->branch_info->srcline_from) in hists__calc_col_len()
155 strlen(h->branch_info->srcline_from)); in hists__calc_col_len()
156 if (h->branch_info->srcline_to) in hists__calc_col_len()
158 strlen(h->branch_info->srcline_to)); in hists__calc_col_len()
161 if (h->mem_info) { in hists__calc_col_len()
162 if (mem_info__daddr(h->mem_info)->ms.sym) { in hists__calc_col_len()
163 symlen = (int)mem_info__daddr(h->mem_info)->ms.sym->namelen + 4 in hists__calc_col_len()
177 if (mem_info__iaddr(h->mem_info)->ms.sym) { in hists__calc_col_len()
178 symlen = (int)mem_info__iaddr(h->mem_info)->ms.sym->namelen + 4 in hists__calc_col_len()
188 if (mem_info__daddr(h->mem_info)->ms.map) { in hists__calc_col_len()
189 symlen = dso__name_len(map__dso(mem_info__daddr(h->mem_info)->ms.map)); in hists__calc_col_len()
237 if (h->srcline) { in hists__calc_col_len()
238 len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header)); in hists__calc_col_len()
242 if (h->srcfile) in hists__calc_col_len()
243 hists__new_col_len(hists, HISTC_SRCFILE, strlen(h->srcfile)); in hists__calc_col_len()
245 if (h->transaction) in hists__calc_col_len()
249 if (h->trace_output) in hists__calc_col_len()
250 hists__new_col_len(hists, HISTC_TRACE, strlen(h->trace_output)); in hists__calc_col_len()
252 if (h->cgroup) { in hists__calc_col_len()
254 struct cgroup *cgrp = cgroup__find(maps__machine(h->ms.maps)->env, in hists__calc_col_len()
255 h->cgroup); in hists__calc_col_len()
257 cgrp_name = cgrp->name; in hists__calc_col_len()
265 struct rb_node *next = rb_first_cached(&hists->entries); in hists__output_recalc_col_len()
273 if (!n->filtered) in hists__output_recalc_col_len()
275 next = rb_next(&n->rb_node); in hists__output_recalc_col_len()
284 he_stat->period_sys += period; in he_stat__add_cpumode_period()
287 he_stat->period_us += period; in he_stat__add_cpumode_period()
290 he_stat->period_guest_sys += period; in he_stat__add_cpumode_period()
293 he_stat->period_guest_us += period; in he_stat__add_cpumode_period()
308 static void he_stat__add_period(struct he_stat *he_stat, u64 period, u64 latency) in he_stat__add_period() argument
310 he_stat->period += period; in he_stat__add_period()
311 he_stat->latency += latency; in he_stat__add_period()
312 he_stat->nr_events += 1; in he_stat__add_period()
317 dest->period += src->period; in he_stat__add_stat()
318 dest->period_sys += src->period_sys; in he_stat__add_stat()
319 dest->period_us += src->period_us; in he_stat__add_stat()
320 dest->period_guest_sys += src->period_guest_sys; in he_stat__add_stat()
321 dest->period_guest_us += src->period_guest_us; in he_stat__add_stat()
322 dest->weight1 += src->weight1; in he_stat__add_stat()
323 dest->weight2 += src->weight2; in he_stat__add_stat()
324 dest->weight3 += src->weight3; in he_stat__add_stat()
325 dest->nr_events += src->nr_events; in he_stat__add_stat()
326 dest->latency += src->latency; in he_stat__add_stat()
331 he_stat->period = (he_stat->period * 7) / 8; in he_stat__decay()
332 he_stat->nr_events = (he_stat->nr_events * 7) / 8; in he_stat__decay()
333 he_stat->weight1 = (he_stat->weight1 * 7) / 8; in he_stat__decay()
334 he_stat->weight2 = (he_stat->weight2 * 7) / 8; in he_stat__decay()
335 he_stat->weight3 = (he_stat->weight3 * 7) / 8; in he_stat__decay()
336 he_stat->latency = (he_stat->latency * 7) / 8; in he_stat__decay()
343 u64 prev_period = he->stat.period; in hists__decay_entry()
344 u64 prev_latency = he->stat.latency; in hists__decay_entry()
349 he_stat__decay(&he->stat); in hists__decay_entry()
351 he_stat__decay(he->stat_acc); in hists__decay_entry()
352 decay_callchain(he->callchain); in hists__decay_entry()
354 if (!he->depth) { in hists__decay_entry()
355 u64 period_diff = prev_period - he->stat.period; in hists__decay_entry()
356 u64 latency_diff = prev_latency - he->stat.latency; in hists__decay_entry()
358 hists->stats.total_period -= period_diff; in hists__decay_entry()
359 hists->stats.total_latency -= latency_diff; in hists__decay_entry()
360 if (!he->filtered) { in hists__decay_entry()
361 hists->stats.total_non_filtered_period -= period_diff; in hists__decay_entry()
362 hists->stats.total_non_filtered_latency -= latency_diff; in hists__decay_entry()
366 if (!he->leaf) { in hists__decay_entry()
368 struct rb_node *node = rb_first_cached(&he->hroot_out); in hists__decay_entry()
378 return he->stat.period == 0 && he->stat.latency == 0; in hists__decay_entry()
386 if (he->parent_he) { in hists__delete_entry()
387 root_in = &he->parent_he->hroot_in; in hists__delete_entry()
388 root_out = &he->parent_he->hroot_out; in hists__delete_entry()
391 root_in = &hists->entries_collapsed; in hists__delete_entry()
393 root_in = hists->entries_in; in hists__delete_entry()
394 root_out = &hists->entries; in hists__delete_entry()
397 rb_erase_cached(&he->rb_node_in, root_in); in hists__delete_entry()
398 rb_erase_cached(&he->rb_node, root_out); in hists__delete_entry()
400 --hists->nr_entries; in hists__delete_entry()
401 if (!he->filtered) in hists__delete_entry()
402 --hists->nr_non_filtered_entries; in hists__delete_entry()
409 struct rb_node *next = rb_first_cached(&hists->entries); in hists__decay_entries()
414 next = rb_next(&n->rb_node); in hists__decay_entries()
415 if (((zap_user && n->level == '.') || in hists__decay_entries()
416 (zap_kernel && n->level != '.') || in hists__decay_entries()
425 struct rb_node *next = rb_first_cached(&hists->entries); in hists__delete_entries()
430 next = rb_next(&n->rb_node); in hists__delete_entries()
438 struct rb_node *next = rb_first_cached(&hists->entries); in hists__get_entry()
447 next = rb_next(&n->rb_node); in hists__get_entry()
464 he->callchain_size = callchain_size; in hist_entry__init()
467 he->stat_acc = malloc(sizeof(he->stat)); in hist_entry__init()
468 if (he->stat_acc == NULL) in hist_entry__init()
469 return -ENOMEM; in hist_entry__init()
470 memcpy(he->stat_acc, &he->stat, sizeof(he->stat)); in hist_entry__init()
472 memset(&he->stat, 0, sizeof(he->stat)); in hist_entry__init()
475 he->ms.maps = maps__get(he->ms.maps); in hist_entry__init()
476 he->ms.map = map__get(he->ms.map); in hist_entry__init()
478 if (he->branch_info) { in hist_entry__init()
484 he->branch_info = malloc(sizeof(*he->branch_info)); in hist_entry__init()
485 if (he->branch_info == NULL) in hist_entry__init()
488 memcpy(he->branch_info, template->branch_info, in hist_entry__init()
489 sizeof(*he->branch_info)); in hist_entry__init()
491 he->branch_info->from.ms.maps = maps__get(he->branch_info->from.ms.maps); in hist_entry__init()
492 he->branch_info->from.ms.map = map__get(he->branch_info->from.ms.map); in hist_entry__init()
493 he->branch_info->to.ms.maps = maps__get(he->branch_info->to.ms.maps); in hist_entry__init()
494 he->branch_info->to.ms.map = map__get(he->branch_info->to.ms.map); in hist_entry__init()
497 if (he->mem_info) { in hist_entry__init()
498 he->mem_info = mem_info__clone(template->mem_info); in hist_entry__init()
499 if (he->mem_info == NULL) in hist_entry__init()
504 callchain_init(he->callchain); in hist_entry__init()
506 if (he->raw_data) { in hist_entry__init()
507 he->raw_data = memdup(he->raw_data, he->raw_size); in hist_entry__init()
508 if (he->raw_data == NULL) in hist_entry__init()
512 if (he->srcline && he->srcline != SRCLINE_UNKNOWN) { in hist_entry__init()
513 he->srcline = strdup(he->srcline); in hist_entry__init()
514 if (he->srcline == NULL) in hist_entry__init()
519 he->res_samples = calloc(symbol_conf.res_sample, in hist_entry__init()
521 if (!he->res_samples) in hist_entry__init()
525 INIT_LIST_HEAD(&he->pairs.node); in hist_entry__init()
526 he->thread = thread__get(he->thread); in hist_entry__init()
527 he->hroot_in = RB_ROOT_CACHED; in hist_entry__init()
528 he->hroot_out = RB_ROOT_CACHED; in hist_entry__init()
531 he->leaf = true; in hist_entry__init()
536 zfree(&he->srcline); in hist_entry__init()
539 zfree(&he->raw_data); in hist_entry__init()
542 if (he->branch_info) { in hist_entry__init()
543 map_symbol__exit(&he->branch_info->from.ms); in hist_entry__init()
544 map_symbol__exit(&he->branch_info->to.ms); in hist_entry__init()
545 zfree(&he->branch_info); in hist_entry__init()
547 if (he->mem_info) { in hist_entry__init()
548 map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms); in hist_entry__init()
549 map_symbol__exit(&mem_info__daddr(he->mem_info)->ms); in hist_entry__init()
552 map_symbol__exit(&he->ms); in hist_entry__init()
553 zfree(&he->stat_acc); in hist_entry__init()
554 return -ENOMEM; in hist_entry__init()
575 struct hist_entry_ops *ops = template->ops; in hist_entry__new()
581 ops = template->ops = &default_ops; in hist_entry__new()
586 he = ops->new(callchain_size); in hist_entry__new()
590 ops->free(he); in hist_entry__new()
604 static void hist_entry__add_callchain_period(struct hist_entry *he, u64 period, u64 latency) in hist_entry__add_callchain_period() argument
609 he->hists->callchain_period += period; in hist_entry__add_callchain_period()
610 he->hists->callchain_latency += latency; in hist_entry__add_callchain_period()
611 if (!he->filtered) { in hist_entry__add_callchain_period()
612 he->hists->callchain_non_filtered_period += period; in hist_entry__add_callchain_period()
613 he->hists->callchain_non_filtered_latency += latency; in hist_entry__add_callchain_period()
618 struct hist_entry *entry, in hists__findnew_entry() argument
626 u64 period = entry->stat.period; in hists__findnew_entry()
627 u64 latency = entry->stat.latency; in hists__findnew_entry() local
630 p = &hists->entries_in->rb_root.rb_node; in hists__findnew_entry()
639 * function when searching an entry regardless which sort in hists__findnew_entry()
642 cmp = hist_entry__cmp(he, entry); in hists__findnew_entry()
645 he_stat__add_stat(&he->stat, &entry->stat); in hists__findnew_entry()
646 hist_entry__add_callchain_period(he, period, latency); in hists__findnew_entry()
649 he_stat__add_period(he->stat_acc, period, latency); in hists__findnew_entry()
651 block_info__delete(entry->block_info); in hists__findnew_entry()
653 kvm_info__zput(entry->kvm_info); in hists__findnew_entry()
656 * become out-of-date due to an exec() or in hists__findnew_entry()
658 * mis-adjust symbol addresses when computing in hists__findnew_entry()
661 if (hists__has(hists, sym) && he->ms.map != entry->ms.map) { in hists__findnew_entry()
662 if (he->ms.sym) { in hists__findnew_entry()
663 u64 addr = he->ms.sym->start; in hists__findnew_entry()
664 he->ms.sym = map__find_symbol(entry->ms.map, addr); in hists__findnew_entry()
667 map__put(he->ms.map); in hists__findnew_entry()
668 he->ms.map = map__get(entry->ms.map); in hists__findnew_entry()
674 p = &(*p)->rb_left; in hists__findnew_entry()
676 p = &(*p)->rb_right; in hists__findnew_entry()
681 he = hist_entry__new(entry, sample_self); in hists__findnew_entry()
686 hist_entry__add_callchain_period(he, period, latency); in hists__findnew_entry()
687 hists->nr_entries++; in hists__findnew_entry()
689 rb_link_node(&he->rb_node_in, parent, p); in hists__findnew_entry()
690 rb_insert_color_cached(&he->rb_node_in, hists->entries_in, leftmost); in hists__findnew_entry()
693 he_stat__add_cpumode_period(&he->stat, al->cpumode, period); in hists__findnew_entry()
695 he_stat__add_cpumode_period(he->stat_acc, al->cpumode, period); in hists__findnew_entry()
701 unsigned thresh = -high % high; in random_max()
714 if (he->num_res < symbol_conf.res_sample) { in hists__res_sample()
715 j = he->num_res++; in hists__res_sample()
719 r = &he->res_samples[j]; in hists__res_sample()
720 r->time = sample->time; in hists__res_sample()
721 r->cpu = sample->cpu; in hists__res_sample()
722 r->tid = sample->tid; in hists__res_sample()
737 struct namespaces *ns = thread__namespaces(al->thread); in __hists__add_entry()
738 struct hist_entry entry = { in __hists__add_entry() local
739 .thread = al->thread, in __hists__add_entry()
740 .comm = thread__comm(al->thread), in __hists__add_entry()
742 .dev = ns ? ns->link_info[CGROUP_NS_INDEX].dev : 0, in __hists__add_entry()
743 .ino = ns ? ns->link_info[CGROUP_NS_INDEX].ino : 0, in __hists__add_entry()
745 .cgroup = sample->cgroup, in __hists__add_entry()
747 .maps = al->maps, in __hists__add_entry()
748 .map = al->map, in __hists__add_entry()
749 .sym = al->sym, in __hists__add_entry()
751 .srcline = (char *) al->srcline, in __hists__add_entry()
752 .socket = al->socket, in __hists__add_entry()
753 .cpu = al->cpu, in __hists__add_entry()
754 .cpumode = al->cpumode, in __hists__add_entry()
755 .ip = al->addr, in __hists__add_entry()
756 .level = al->level, in __hists__add_entry()
757 .code_page_size = sample->code_page_size, in __hists__add_entry()
758 .parallelism = al->parallelism, in __hists__add_entry()
761 .period = sample->period, in __hists__add_entry()
762 .weight1 = sample->weight, in __hists__add_entry()
763 .weight2 = sample->ins_lat, in __hists__add_entry()
764 .weight3 = sample->p_stage_cyc, in __hists__add_entry()
765 .latency = al->latency, in __hists__add_entry()
768 .filtered = symbol__parent_filter(sym_parent) | al->filtered, in __hists__add_entry()
774 .transaction = sample->transaction, in __hists__add_entry()
775 .raw_data = sample->raw_data, in __hists__add_entry()
776 .raw_size = sample->raw_size, in __hists__add_entry()
778 .time = hist_time(sample->time), in __hists__add_entry()
779 .weight = sample->weight, in __hists__add_entry()
780 .ins_lat = sample->ins_lat, in __hists__add_entry()
781 .p_stage_cyc = sample->p_stage_cyc, in __hists__add_entry()
782 .simd_flags = sample->simd_flags, in __hists__add_entry()
783 }, *he = hists__findnew_entry(hists, &entry, al, sample_self); in __hists__add_entry()
785 if (!hists->has_callchains && he && he->callchain_size != 0) in __hists__add_entry()
786 hists->has_callchains = true; in __hists__add_entry()
823 struct hist_entry entry = { in hists__add_entry_block() local
827 .maps = al->maps, in hists__add_entry_block()
828 .map = al->map, in hists__add_entry_block()
829 .sym = al->sym, in hists__add_entry_block()
831 }, *he = hists__findnew_entry(hists, &entry, al, false); in hists__add_entry_block()
853 struct perf_sample *sample = iter->sample; in iter_prepare_mem_entry()
858 return -ENOMEM; in iter_prepare_mem_entry()
860 iter->mi = mi; in iter_prepare_mem_entry()
868 struct mem_info *mi = iter->mi; in iter_add_single_mem_entry()
869 struct hists *hists = evsel__hists(iter->evsel); in iter_add_single_mem_entry()
870 struct perf_sample *sample = iter->sample; in iter_add_single_mem_entry()
874 return -EINVAL; in iter_add_single_mem_entry()
876 cost = sample->weight; in iter_add_single_mem_entry()
887 sample->period = cost; in iter_add_single_mem_entry()
889 he = hists__add_entry(hists, al, iter->parent, NULL, mi, NULL, in iter_add_single_mem_entry()
892 return -ENOMEM; in iter_add_single_mem_entry()
894 iter->he = he; in iter_add_single_mem_entry()
902 struct evsel *evsel = iter->evsel; in iter_finish_mem_entry()
904 struct hist_entry *he = iter->he; in iter_finish_mem_entry()
905 int err = -EINVAL; in iter_finish_mem_entry()
910 hists__inc_nr_samples(hists, he->filtered); in iter_finish_mem_entry()
912 err = hist_entry__append_callchain(he, iter->sample); in iter_finish_mem_entry()
915 mem_info__zput(iter->mi); in iter_finish_mem_entry()
917 iter->he = NULL; in iter_finish_mem_entry()
925 struct perf_sample *sample = iter->sample; in iter_prepare_branch_entry()
929 return -ENOMEM; in iter_prepare_branch_entry()
931 iter->curr = 0; in iter_prepare_branch_entry()
932 iter->total = sample->branch_stack->nr; in iter_prepare_branch_entry()
934 iter->bi = bi; in iter_prepare_branch_entry()
948 struct branch_info *bi = iter->bi; in iter_next_branch_entry()
949 int i = iter->curr; in iter_next_branch_entry()
954 if (iter->curr >= iter->total) in iter_next_branch_entry()
957 maps__put(al->maps); in iter_next_branch_entry()
958 al->maps = maps__get(bi[i].to.ms.maps); in iter_next_branch_entry()
959 map__put(al->map); in iter_next_branch_entry()
960 al->map = map__get(bi[i].to.ms.map); in iter_next_branch_entry()
961 al->sym = bi[i].to.ms.sym; in iter_next_branch_entry()
962 al->addr = bi[i].to.addr; in iter_next_branch_entry()
970 struct evsel *evsel = iter->evsel; in iter_add_next_branch_entry()
972 struct perf_sample *sample = iter->sample; in iter_add_next_branch_entry()
974 int i = iter->curr; in iter_add_next_branch_entry()
977 bi = iter->bi; in iter_add_next_branch_entry()
979 if (iter->hide_unresolved && !(bi[i].from.ms.sym && bi[i].to.ms.sym)) in iter_add_next_branch_entry()
986 sample->period = 1; in iter_add_next_branch_entry()
987 sample->weight = bi->flags.cycles ? bi->flags.cycles : 1; in iter_add_next_branch_entry()
989 he = hists__add_entry(hists, al, iter->parent, &bi[i], NULL, NULL, in iter_add_next_branch_entry()
992 return -ENOMEM; in iter_add_next_branch_entry()
995 iter->he = he; in iter_add_next_branch_entry()
996 iter->curr++; in iter_add_next_branch_entry()
1002 map_symbol__exit(&bi->from.ms); in branch_info__exit()
1003 map_symbol__exit(&bi->to.ms); in branch_info__exit()
1004 zfree_srcline(&bi->srcline_from); in branch_info__exit()
1005 zfree_srcline(&bi->srcline_to); in branch_info__exit()
1012 struct evsel *evsel = iter->evsel; in iter_finish_branch_entry()
1015 for (int i = 0; i < iter->total; i++) in iter_finish_branch_entry()
1016 branch_info__exit(&iter->bi[i]); in iter_finish_branch_entry()
1018 if (iter->he) in iter_finish_branch_entry()
1019 hists__inc_nr_samples(hists, iter->he->filtered); in iter_finish_branch_entry()
1021 zfree(&iter->bi); in iter_finish_branch_entry()
1022 iter->he = NULL; in iter_finish_branch_entry()
1024 return iter->curr >= iter->total ? 0 : -1; in iter_finish_branch_entry()
1037 struct evsel *evsel = iter->evsel; in iter_add_single_normal_entry()
1038 struct perf_sample *sample = iter->sample; in iter_add_single_normal_entry()
1041 he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, in iter_add_single_normal_entry()
1044 return -ENOMEM; in iter_add_single_normal_entry()
1046 iter->he = he; in iter_add_single_normal_entry()
1054 struct hist_entry *he = iter->he; in iter_finish_normal_entry()
1055 struct evsel *evsel = iter->evsel; in iter_finish_normal_entry()
1056 struct perf_sample *sample = iter->sample; in iter_finish_normal_entry()
1061 iter->he = NULL; in iter_finish_normal_entry()
1063 hists__inc_nr_samples(evsel__hists(evsel), he->filtered); in iter_finish_normal_entry()
1076 return -ENOMEM; in iter_prepare_cumulative_entry()
1085 he_cache = malloc(sizeof(*he_cache) * (cursor->nr + 1)); in iter_prepare_cumulative_entry()
1087 return -ENOMEM; in iter_prepare_cumulative_entry()
1089 iter->he_cache = he_cache; in iter_prepare_cumulative_entry()
1090 iter->curr = 0; in iter_prepare_cumulative_entry()
1099 struct evsel *evsel = iter->evsel; in iter_add_single_cumulative_entry()
1101 struct perf_sample *sample = iter->sample; in iter_add_single_cumulative_entry()
1102 struct hist_entry **he_cache = iter->he_cache; in iter_add_single_cumulative_entry()
1106 he = hists__add_entry(hists, al, iter->parent, NULL, NULL, NULL, in iter_add_single_cumulative_entry()
1109 return -ENOMEM; in iter_add_single_cumulative_entry()
1111 iter->he = he; in iter_add_single_cumulative_entry()
1112 he_cache[iter->curr++] = he; in iter_add_single_cumulative_entry()
1117 * We need to re-initialize the cursor since callchain_append() in iter_add_single_cumulative_entry()
1122 hists__inc_nr_samples(hists, he->filtered); in iter_add_single_cumulative_entry()
1137 return fill_callchain_info(al, node, iter->hide_unresolved); in iter_next_cumulative_entry()
1144 struct symbol *sym_l = left->ms.sym; in hist_entry__fast__sym_diff()
1145 struct symbol *sym_r = right->ms.sym; in hist_entry__fast__sym_diff()
1148 return left->ip != right->ip; in hist_entry__fast__sym_diff()
1158 struct evsel *evsel = iter->evsel; in iter_add_next_cumulative_entry()
1159 struct perf_sample *sample = iter->sample; in iter_add_next_cumulative_entry()
1160 struct hist_entry **he_cache = iter->he_cache; in iter_add_next_cumulative_entry()
1164 .cpu = al->cpu, in iter_add_next_cumulative_entry()
1165 .thread = al->thread, in iter_add_next_cumulative_entry()
1166 .comm = thread__comm(al->thread), in iter_add_next_cumulative_entry()
1167 .ip = al->addr, in iter_add_next_cumulative_entry()
1169 .maps = al->maps, in iter_add_next_cumulative_entry()
1170 .map = al->map, in iter_add_next_cumulative_entry()
1171 .sym = al->sym, in iter_add_next_cumulative_entry()
1173 .srcline = (char *) al->srcline, in iter_add_next_cumulative_entry()
1174 .parent = iter->parent, in iter_add_next_cumulative_entry()
1175 .raw_data = sample->raw_data, in iter_add_next_cumulative_entry()
1176 .raw_size = sample->raw_size, in iter_add_next_cumulative_entry()
1183 return -ENOMEM; in iter_add_next_cumulative_entry()
1193 for (i = 0; i < iter->curr; i++) { in iter_add_next_cumulative_entry()
1204 iter->he = NULL; in iter_add_next_cumulative_entry()
1209 he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, in iter_add_next_cumulative_entry()
1212 return -ENOMEM; in iter_add_next_cumulative_entry()
1214 iter->he = he; in iter_add_next_cumulative_entry()
1215 he_cache[iter->curr++] = he; in iter_add_next_cumulative_entry()
1218 callchain_append(he->callchain, &cursor, sample->period); in iter_add_next_cumulative_entry()
1226 mem_info__zput(iter->mi); in iter_finish_cumulative_entry()
1227 zfree(&iter->bi); in iter_finish_cumulative_entry()
1228 zfree(&iter->he_cache); in iter_finish_cumulative_entry()
1229 iter->he = NULL; in iter_finish_cumulative_entry()
1273 alm = map__get(al->map); in hist_entry_iter__add()
1275 err = sample__resolve_callchain(iter->sample, get_tls_callchain_cursor(), &iter->parent, in hist_entry_iter__add()
1276 iter->evsel, al, max_stack_depth); in hist_entry_iter__add()
1282 err = iter->ops->prepare_entry(iter, al); in hist_entry_iter__add()
1286 err = iter->ops->add_single_entry(iter, al); in hist_entry_iter__add()
1290 if (iter->he && iter->add_entry_cb) { in hist_entry_iter__add()
1291 err = iter->add_entry_cb(iter, al, true, arg); in hist_entry_iter__add()
1296 while (iter->ops->next_entry(iter, al)) { in hist_entry_iter__add()
1297 err = iter->ops->add_next_entry(iter, al); in hist_entry_iter__add()
1301 if (iter->he && iter->add_entry_cb) { in hist_entry_iter__add()
1302 err = iter->add_entry_cb(iter, al, false, arg); in hist_entry_iter__add()
1309 err2 = iter->ops->finish_entry(iter, al); in hist_entry_iter__add()
1323 struct hists *hists = left->hists; in hist_entry__cmp_impl()
1329 * Never collapse filtered and non-filtered entries. in hist_entry__cmp_impl()
1333 cmp = (int64_t)!!left->filtered - (int64_t)!!right->filtered; in hist_entry__cmp_impl()
1357 return hist_entry__cmp_impl(left->hists->hpp_list, left, right, in hist_entry__cmp()
1364 return hist_entry__cmp_impl(left->hists->hpp_list, left, right, in hist_entry__sort()
1371 return hist_entry__cmp_impl(left->hists->hpp_list, left, right, in hist_entry__collapse()
1386 struct hist_entry_ops *ops = he->ops; in hist_entry__delete()
1389 struct rb_root *root = &he->hroot_out.rb_root; in hist_entry__delete()
1398 thread__zput(he->thread); in hist_entry__delete()
1399 map_symbol__exit(&he->ms); in hist_entry__delete()
1401 if (he->branch_info) { in hist_entry__delete()
1402 branch_info__exit(he->branch_info); in hist_entry__delete()
1403 zfree(&he->branch_info); in hist_entry__delete()
1406 if (he->mem_info) { in hist_entry__delete()
1407 map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms); in hist_entry__delete()
1408 map_symbol__exit(&mem_info__daddr(he->mem_info)->ms); in hist_entry__delete()
1409 mem_info__zput(he->mem_info); in hist_entry__delete()
1412 if (he->block_info) in hist_entry__delete()
1413 block_info__delete(he->block_info); in hist_entry__delete()
1415 if (he->kvm_info) in hist_entry__delete()
1416 kvm_info__zput(he->kvm_info); in hist_entry__delete()
1418 zfree(&he->res_samples); in hist_entry__delete()
1419 zfree(&he->stat_acc); in hist_entry__delete()
1420 zfree_srcline(&he->srcline); in hist_entry__delete()
1421 if (he->srcfile && he->srcfile[0]) in hist_entry__delete()
1422 zfree(&he->srcfile); in hist_entry__delete()
1423 free_callchain(he->callchain); in hist_entry__delete()
1424 zfree(&he->trace_output); in hist_entry__delete()
1425 zfree(&he->raw_data); in hist_entry__delete()
1426 ops->free(he); in hist_entry__delete()
1431 * pre-calculated max length for this column, otherwise don't bother adding
1439 if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) { in hist_entry__snprintf_alignment()
1440 const int width = fmt->width(fmt, hpp, he->hists); in hist_entry__snprintf_alignment()
1443 printed = scnprintf(hpp->buf, hpp->size, "%-*s", width - printed, " "); in hist_entry__snprintf_alignment()
1471 struct hist_entry *parent = he->parent_he; in hist_entry__check_and_remove_filter()
1502 perf_hpp_list__for_each_format(he->hpp_list, fmt) { in hist_entry__check_and_remove_filter()
1511 * If the filter is for current level entry, propagate in hist_entry__check_and_remove_filter()
1514 * non-filtered entries. in hist_entry__check_and_remove_filter()
1516 if (!(he->filtered & (1 << type))) { in hist_entry__check_and_remove_filter()
1518 parent->filtered &= ~(1 << type); in hist_entry__check_and_remove_filter()
1519 parent = parent->parent_he; in hist_entry__check_and_remove_filter()
1524 * If current entry doesn't have matching formats, set in hist_entry__check_and_remove_filter()
1528 * For lower-level entries, it inherits parent's in hist_entry__check_and_remove_filter()
1530 * non-filtered entry won't set the filter marker. in hist_entry__check_and_remove_filter()
1533 he->filtered |= (1 << type); in hist_entry__check_and_remove_filter()
1535 he->filtered |= (parent->filtered & (1 << type)); in hist_entry__check_and_remove_filter()
1553 hists__apply_filters(he->hists, he); in hist_entry__apply_hierarchy_filters()
1562 struct rb_node **p = &root->rb_root.rb_node; in hierarchy_insert_entry()
1574 he_stat__add_stat(&iter->stat, &he->stat); in hierarchy_insert_entry()
1579 p = &parent->rb_left; in hierarchy_insert_entry()
1581 p = &parent->rb_right; in hierarchy_insert_entry()
1590 hists->nr_entries++; in hierarchy_insert_entry()
1593 new->hpp_list = hpp_list; in hierarchy_insert_entry()
1594 new->parent_he = parent_he; in hierarchy_insert_entry()
1601 he->trace_output = NULL; in hierarchy_insert_entry()
1603 new->trace_output = NULL; in hierarchy_insert_entry()
1606 he->srcline = NULL; in hierarchy_insert_entry()
1608 new->srcline = NULL; in hierarchy_insert_entry()
1611 he->srcfile = NULL; in hierarchy_insert_entry()
1613 new->srcfile = NULL; in hierarchy_insert_entry()
1616 rb_link_node(&new->rb_node_in, parent, p); in hierarchy_insert_entry()
1617 rb_insert_color_cached(&new->rb_node_in, root, leftmost); in hierarchy_insert_entry()
1631 list_for_each_entry(node, &hists->hpp_formats, list) { in hists__hierarchy_insert_entry()
1633 if (node->level == 0 || node->skip) in hists__hierarchy_insert_entry()
1637 new_he = hierarchy_insert_entry(hists, root, he, parent, &node->hpp); in hists__hierarchy_insert_entry()
1639 ret = -1; in hists__hierarchy_insert_entry()
1643 root = &new_he->hroot_in; in hists__hierarchy_insert_entry()
1644 new_he->depth = depth++; in hists__hierarchy_insert_entry()
1649 new_he->leaf = true; in hists__hierarchy_insert_entry()
1656 return -1; in hists__hierarchy_insert_entry()
1660 new_he->callchain, in hists__hierarchy_insert_entry()
1661 he->callchain) < 0) in hists__hierarchy_insert_entry()
1662 ret = -1; in hists__hierarchy_insert_entry()
1669 /* return 0 (or -1) since it already applied filters */ in hists__hierarchy_insert_entry()
1677 struct rb_node **p = &root->rb_root.rb_node; in hists__collapse_insert_entry()
1695 he_stat__add_stat(&iter->stat, &he->stat); in hists__collapse_insert_entry()
1697 he_stat__add_stat(iter->stat_acc, he->stat_acc); in hists__collapse_insert_entry()
1704 if (callchain_merge(cursor, iter->callchain, he->callchain) < 0) in hists__collapse_insert_entry()
1705 ret = -1; in hists__collapse_insert_entry()
1715 p = &(*p)->rb_left; in hists__collapse_insert_entry()
1717 p = &(*p)->rb_right; in hists__collapse_insert_entry()
1721 hists->nr_entries++; in hists__collapse_insert_entry()
1723 rb_link_node(&he->rb_node_in, parent, p); in hists__collapse_insert_entry()
1724 rb_insert_color_cached(&he->rb_node_in, root, leftmost); in hists__collapse_insert_entry()
1732 mutex_lock(&hists->lock); in hists__get_rotate_entries_in()
1734 root = hists->entries_in; in hists__get_rotate_entries_in()
1735 if (++hists->entries_in > &hists->entries_in_array[1]) in hists__get_rotate_entries_in()
1736 hists->entries_in = &hists->entries_in_array[0]; in hists__get_rotate_entries_in()
1738 mutex_unlock(&hists->lock); in hists__get_rotate_entries_in()
1762 hists->nr_entries = 0; in hists__collapse_resort()
1772 next = rb_next(&n->rb_node_in); in hists__collapse_resort()
1774 rb_erase_cached(&n->rb_node_in, root); in hists__collapse_resort()
1775 ret = hists__collapse_insert_entry(hists, &hists->entries_collapsed, n); in hists__collapse_resort()
1777 return -1; in hists__collapse_resort()
1795 hists->nr_non_filtered_entries = 0; in hists__reset_filter_stats()
1796 hists->stats.total_non_filtered_period = 0; in hists__reset_filter_stats()
1797 hists->stats.total_non_filtered_latency = 0; in hists__reset_filter_stats()
1802 hists->nr_entries = 0; in hists__reset_stats()
1803 hists->stats.total_period = 0; in hists__reset_stats()
1804 hists->stats.total_latency = 0; in hists__reset_stats()
1811 hists->nr_non_filtered_entries++; in hists__inc_filter_stats()
1812 hists->stats.total_non_filtered_period += h->stat.period; in hists__inc_filter_stats()
1813 hists->stats.total_non_filtered_latency += h->stat.latency; in hists__inc_filter_stats()
1818 if (!h->filtered) in hists__inc_stats()
1821 hists->nr_entries++; in hists__inc_stats()
1822 hists->stats.total_period += h->stat.period; in hists__inc_stats()
1823 hists->stats.total_latency += h->stat.latency; in hists__inc_stats()
1831 node = rb_first_cached(&hists->entries); in hierarchy_recalc_total_periods()
1833 hists->stats.total_period = 0; in hierarchy_recalc_total_periods()
1834 hists->stats.total_non_filtered_period = 0; in hierarchy_recalc_total_periods()
1835 hists->stats.total_latency = 0; in hierarchy_recalc_total_periods()
1836 hists->stats.total_non_filtered_latency = 0; in hierarchy_recalc_total_periods()
1839 * recalculate total period using top-level entries only in hierarchy_recalc_total_periods()
1840 * since lower level entries only see non-filtered entries in hierarchy_recalc_total_periods()
1847 hists->stats.total_period += he->stat.period; in hierarchy_recalc_total_periods()
1848 hists->stats.total_latency += he->stat.latency; in hierarchy_recalc_total_periods()
1849 if (!he->filtered) { in hierarchy_recalc_total_periods()
1850 hists->stats.total_non_filtered_period += he->stat.period; in hierarchy_recalc_total_periods()
1851 hists->stats.total_non_filtered_latency += he->stat.latency; in hierarchy_recalc_total_periods()
1859 struct rb_node **p = &root->rb_root.rb_node; in hierarchy_insert_output_entry()
1870 p = &parent->rb_left; in hierarchy_insert_output_entry()
1872 p = &parent->rb_right; in hierarchy_insert_output_entry()
1877 rb_link_node(&he->rb_node, parent, p); in hierarchy_insert_output_entry()
1878 rb_insert_color_cached(&he->rb_node, root, leftmost); in hierarchy_insert_output_entry()
1880 /* update column width of dynamic entry */ in hierarchy_insert_output_entry()
1881 perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { in hierarchy_insert_output_entry()
1882 if (fmt->init) in hierarchy_insert_output_entry()
1883 fmt->init(fmt, he); in hierarchy_insert_output_entry()
1909 hists->nr_entries++; in hists__hierarchy_output_resort()
1910 if (!he->filtered) { in hists__hierarchy_output_resort()
1911 hists->nr_non_filtered_entries++; in hists__hierarchy_output_resort()
1915 if (!he->leaf) { in hists__hierarchy_output_resort()
1917 &he->hroot_in, in hists__hierarchy_output_resort()
1918 &he->hroot_out, in hists__hierarchy_output_resort()
1928 u64 total = he->stat.period; in hists__hierarchy_output_resort()
1931 total = he->stat_acc->period; in hists__hierarchy_output_resort()
1936 callchain_param.sort(&he->sorted_chain, he->callchain, in hists__hierarchy_output_resort()
1946 struct rb_node **p = &entries->rb_root.rb_node; in __hists__insert_output_entry()
1954 u64 total = he->stat.period; in __hists__insert_output_entry()
1957 total = he->stat_acc->period; in __hists__insert_output_entry()
1961 callchain_param.sort(&he->sorted_chain, he->callchain, in __hists__insert_output_entry()
1970 p = &(*p)->rb_left; in __hists__insert_output_entry()
1972 p = &(*p)->rb_right; in __hists__insert_output_entry()
1977 rb_link_node(&he->rb_node, parent, p); in __hists__insert_output_entry()
1978 rb_insert_color_cached(&he->rb_node, entries, leftmost); in __hists__insert_output_entry()
1982 if (fmt->init) in __hists__insert_output_entry()
1983 fmt->init(fmt, he); in __hists__insert_output_entry()
1997 callchain_total = hists->callchain_period; in output_resort()
1999 callchain_total = hists->callchain_non_filtered_period; in output_resort()
2008 &hists->entries_collapsed, in output_resort()
2009 &hists->entries, in output_resort()
2017 root = &hists->entries_collapsed; in output_resort()
2019 root = hists->entries_in; in output_resort()
2022 hists->entries = RB_ROOT_CACHED; in output_resort()
2026 next = rb_next(&n->rb_node_in); in output_resort()
2031 __hists__insert_output_entry(&hists->entries, n, min_callchain_hits, use_callchain); in output_resort()
2034 if (!n->filtered) in output_resort()
2075 if (he->leaf || hmd == HMD_FORCE_SIBLING) in can_goto_child()
2078 if (he->unfolded || hmd == HMD_FORCE_CHILD) in can_goto_child()
2089 node = rb_last(&he->hroot_out.rb_root); in rb_hierarchy_last()
2100 node = rb_first_cached(&he->hroot_out); in __rb_hierarchy_next()
2105 he = he->parent_he; in __rb_hierarchy_next()
2109 node = rb_next(&he->rb_node); in __rb_hierarchy_next()
2122 he = he->parent_he; in rb_hierarchy_prev()
2126 return &he->rb_node; in rb_hierarchy_prev()
2135 if (he->leaf) in hist_entry__has_hierarchy_children()
2138 node = rb_first_cached(&he->hroot_out); in hist_entry__has_hierarchy_children()
2141 while (node && child->filtered) { in hist_entry__has_hierarchy_children()
2157 h->filtered &= ~(1 << filter); in hists__remove_entry_filter()
2160 struct hist_entry *parent = h->parent_he; in hists__remove_entry_filter()
2163 he_stat__add_stat(&parent->stat, &h->stat); in hists__remove_entry_filter()
2165 parent->filtered &= ~(1 << filter); in hists__remove_entry_filter()
2167 if (parent->filtered) in hists__remove_entry_filter()
2170 /* force fold unfiltered entry for simplicity */ in hists__remove_entry_filter()
2171 parent->unfolded = false; in hists__remove_entry_filter()
2172 parent->has_no_entry = false; in hists__remove_entry_filter()
2173 parent->row_offset = 0; in hists__remove_entry_filter()
2174 parent->nr_rows = 0; in hists__remove_entry_filter()
2176 parent = parent->parent_he; in hists__remove_entry_filter()
2180 if (h->filtered) in hists__remove_entry_filter()
2183 /* force fold unfiltered entry for simplicity */ in hists__remove_entry_filter()
2184 h->unfolded = false; in hists__remove_entry_filter()
2185 h->has_no_entry = false; in hists__remove_entry_filter()
2186 h->row_offset = 0; in hists__remove_entry_filter()
2187 h->nr_rows = 0; in hists__remove_entry_filter()
2189 hists->stats.nr_non_filtered_samples += h->stat.nr_events; in hists__remove_entry_filter()
2199 if (hists->dso_filter != NULL && in hists__filter_entry_by_dso()
2200 (he->ms.map == NULL || !RC_CHK_EQUAL(map__dso(he->ms.map), hists->dso_filter))) { in hists__filter_entry_by_dso()
2201 he->filtered |= (1 << HIST_FILTER__DSO); in hists__filter_entry_by_dso()
2211 if (hists->thread_filter != NULL && in hists__filter_entry_by_thread()
2212 !RC_CHK_EQUAL(he->thread, hists->thread_filter)) { in hists__filter_entry_by_thread()
2213 he->filtered |= (1 << HIST_FILTER__THREAD); in hists__filter_entry_by_thread()
2223 if (hists->symbol_filter_str != NULL && in hists__filter_entry_by_symbol()
2224 (!he->ms.sym || strstr(he->ms.sym->name, in hists__filter_entry_by_symbol()
2225 hists->symbol_filter_str) == NULL)) { in hists__filter_entry_by_symbol()
2226 he->filtered |= (1 << HIST_FILTER__SYMBOL); in hists__filter_entry_by_symbol()
2236 if ((hists->socket_filter > -1) && in hists__filter_entry_by_socket()
2237 (he->socket != hists->socket_filter)) { in hists__filter_entry_by_socket()
2238 he->filtered |= (1 << HIST_FILTER__SOCKET); in hists__filter_entry_by_socket()
2248 if (test_bit(he->parallelism, hists->parallelism_filter)) { in hists__filter_entry_by_parallelism()
2249 he->filtered |= (1 << HIST_FILTER__PARALLELISM); in hists__filter_entry_by_parallelism()
2261 hists->stats.nr_non_filtered_samples = 0; in hists__filter_by_type()
2266 for (nd = rb_first_cached(&hists->entries); nd; nd = rb_next(nd)) { in hists__filter_by_type()
2279 struct rb_node **p = &root->rb_root.rb_node; in resort_filtered_entry()
2291 p = &(*p)->rb_left; in resort_filtered_entry()
2293 p = &(*p)->rb_right; in resort_filtered_entry()
2298 rb_link_node(&he->rb_node, parent, p); in resort_filtered_entry()
2299 rb_insert_color_cached(&he->rb_node, root, leftmost); in resort_filtered_entry()
2301 if (he->leaf || he->filtered) in resort_filtered_entry()
2304 nd = rb_first_cached(&he->hroot_out); in resort_filtered_entry()
2309 rb_erase_cached(&h->rb_node, &he->hroot_out); in resort_filtered_entry()
2314 he->hroot_out = new_root; in resort_filtered_entry()
2322 hists->stats.nr_non_filtered_samples = 0; in hists__filter_hierarchy()
2327 nd = rb_first_cached(&hists->entries); in hists__filter_hierarchy()
2335 * case 1. non-matching type in hists__filter_hierarchy()
2339 memset(&h->stat, 0, sizeof(h->stat)); in hists__filter_hierarchy()
2340 h->filtered |= (1 << type); in hists__filter_hierarchy()
2342 nd = __rb_hierarchy_next(&h->rb_node, HMD_FORCE_CHILD); in hists__filter_hierarchy()
2349 h->filtered |= (1 << type); in hists__filter_hierarchy()
2351 nd = __rb_hierarchy_next(&h->rb_node, HMD_FORCE_SIBLING); in hists__filter_hierarchy()
2361 nd = __rb_hierarchy_next(&h->rb_node, HMD_FORCE_SIBLING); in hists__filter_hierarchy()
2371 nd = rb_first_cached(&hists->entries); in hists__filter_hierarchy()
2376 rb_erase_cached(&h->rb_node, &hists->entries); in hists__filter_hierarchy()
2381 hists->entries = new_root; in hists__filter_hierarchy()
2388 hists->thread_filter); in hists__filter_by_thread()
2398 hists->dso_filter); in hists__filter_by_dso()
2408 hists->symbol_filter_str); in hists__filter_by_symbol()
2418 &hists->socket_filter); in hists__filter_by_socket()
2428 hists->parallelism_filter); in hists__filter_by_parallelism()
2436 ++stats->nr_events[0]; in events_stats__inc()
2437 ++stats->nr_events[type]; in events_stats__inc()
2442 ++stats->nr_samples; in hists_stats__inc()
2447 hists_stats__inc(&hists->stats); in hists__inc_nr_events()
2452 hists_stats__inc(&hists->stats); in hists__inc_nr_samples()
2454 hists->stats.nr_non_filtered_samples++; in hists__inc_nr_samples()
2459 hists->stats.nr_lost_samples += lost; in hists__inc_nr_lost_samples()
2464 hists->stats.nr_dropped_samples += lost; in hists__inc_nr_dropped_samples()
2478 root = &hists->entries_collapsed; in hists__add_dummy_entry()
2480 root = hists->entries_in; in hists__add_dummy_entry()
2482 p = &root->rb_root.rb_node; in hists__add_dummy_entry()
2494 p = &(*p)->rb_left; in hists__add_dummy_entry()
2496 p = &(*p)->rb_right; in hists__add_dummy_entry()
2503 memset(&he->stat, 0, sizeof(he->stat)); in hists__add_dummy_entry()
2504 he->hists = hists; in hists__add_dummy_entry()
2506 memset(he->stat_acc, 0, sizeof(he->stat)); in hists__add_dummy_entry()
2507 rb_link_node(&he->rb_node_in, parent, p); in hists__add_dummy_entry()
2508 rb_insert_color_cached(&he->rb_node_in, root, leftmost); in hists__add_dummy_entry()
2510 he->dummy = true; in hists__add_dummy_entry()
2525 p = &root->rb_root.rb_node; in add_dummy_hierarchy_entry()
2531 cmp = hist_entry__collapse_hierarchy(he->hpp_list, he, pair); in add_dummy_hierarchy_entry()
2536 p = &parent->rb_left; in add_dummy_hierarchy_entry()
2538 p = &parent->rb_right; in add_dummy_hierarchy_entry()
2545 rb_link_node(&he->rb_node_in, parent, p); in add_dummy_hierarchy_entry()
2546 rb_insert_color_cached(&he->rb_node_in, root, leftmost); in add_dummy_hierarchy_entry()
2548 he->dummy = true; in add_dummy_hierarchy_entry()
2549 he->hists = hists; in add_dummy_hierarchy_entry()
2550 memset(&he->stat, 0, sizeof(he->stat)); in add_dummy_hierarchy_entry()
2563 n = hists->entries_collapsed.rb_root.rb_node; in hists__find_entry()
2565 n = hists->entries_in->rb_root.rb_node; in hists__find_entry()
2572 n = n->rb_left; in hists__find_entry()
2574 n = n->rb_right; in hists__find_entry()
2585 struct rb_node *n = root->rb_root.rb_node; in hists__find_hierarchy_entry()
2592 cmp = hist_entry__collapse_hierarchy(he->hpp_list, iter, he); in hists__find_hierarchy_entry()
2594 n = n->rb_left; in hists__find_hierarchy_entry()
2596 n = n->rb_right; in hists__find_hierarchy_entry()
2616 hists__match_hierarchy(&pos->hroot_in, &pair->hroot_in); in hists__match_hierarchy()
2632 return hists__match_hierarchy(&leader->entries_collapsed, in hists__match()
2633 &other->entries_collapsed); in hists__match()
2637 root = &leader->entries_collapsed; in hists__match()
2639 root = leader->entries_in; in hists__match()
2664 list_for_each_entry(leader, &pos->pairs.head, pairs.node) { in hists__link_hierarchy()
2665 if (leader->hists == leader_hists) { in hists__link_hierarchy()
2671 return -1; in hists__link_hierarchy()
2676 return -1; in hists__link_hierarchy()
2679 leader->parent_he = parent; in hists__link_hierarchy()
2684 if (!pos->leaf) { in hists__link_hierarchy()
2686 &leader->hroot_in, in hists__link_hierarchy()
2687 &pos->hroot_in) < 0) in hists__link_hierarchy()
2688 return -1; in hists__link_hierarchy()
2696 * we find them, just add a dummy entry on the leader hists, with period=0,
2708 &leader->entries_collapsed, in hists__link()
2709 &other->entries_collapsed); in hists__link()
2713 root = &other->entries_collapsed; in hists__link()
2715 root = other->entries_in; in hists__link()
2723 return -1; in hists__link()
2738 root = &hists->entries_collapsed; in hists__unlink()
2740 root = hists->entries_in; in hists__unlink()
2744 list_del_init(&pos->pairs.node); in hists__unlink()
2758 if (bs && bs->nr && entries[0].flags.cycles) { in hist__account_cycles()
2773 for (int i = bs->nr - 1; i >= 0; i--) { in hist__account_cycles()
2783 for (unsigned int i = 0; i < bs->nr; i++) { in hist__account_cycles()
2799 u64 total_samples = hists->stats.nr_samples; in evlist__fprintf_nr_events()
2801 total_samples += hists->stats.nr_lost_samples; in evlist__fprintf_nr_events()
2802 total_samples += hists->stats.nr_dropped_samples; in evlist__fprintf_nr_events()
2808 if (hists->stats.nr_samples) in evlist__fprintf_nr_events()
2810 "SAMPLE", hists->stats.nr_samples); in evlist__fprintf_nr_events()
2811 if (hists->stats.nr_lost_samples) in evlist__fprintf_nr_events()
2813 "LOST_SAMPLES", hists->stats.nr_lost_samples); in evlist__fprintf_nr_events()
2814 if (hists->stats.nr_dropped_samples) in evlist__fprintf_nr_events()
2816 "LOST_SAMPLES (BPF)", hists->stats.nr_dropped_samples); in evlist__fprintf_nr_events()
2825 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : in hists__total_period()
2826 hists->stats.total_period; in hists__total_period()
2831 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_latency : in hists__total_latency()
2832 hists->stats.total_latency; in hists__total_latency()
2839 const struct dso *dso = hists->dso_filter; in __hists__scnprintf_title()
2840 struct thread *thread = hists->thread_filter; in __hists__scnprintf_title()
2841 int socket_id = hists->socket_filter; in __hists__scnprintf_title()
2842 unsigned long nr_samples = hists->stats.nr_samples; in __hists__scnprintf_title()
2843 u64 nr_events = hists->stats.total_period; in __hists__scnprintf_title()
2852 nr_samples = hists->stats.nr_non_filtered_samples; in __hists__scnprintf_title()
2853 nr_events = hists->stats.total_non_filtered_period; in __hists__scnprintf_title()
2866 nr_samples += pos_hists->stats.nr_non_filtered_samples; in __hists__scnprintf_title()
2867 nr_events += pos_hists->stats.total_non_filtered_period; in __hists__scnprintf_title()
2869 nr_samples += pos_hists->stats.nr_samples; in __hists__scnprintf_title()
2870 nr_events += pos_hists->stats.total_period; in __hists__scnprintf_title()
2876 strstr(ev_name, "call-graph=no")) in __hists__scnprintf_title()
2880 scnprintf(sample_freq_str, sizeof(sample_freq_str), " %d Hz,", evsel->core.attr.sample_freq); in __hists__scnprintf_title()
2885 nr_samples, unit, evsel->core.nr_members > 1 ? "s" : "", in __hists__scnprintf_title()
2889 if (hists->uid_filter_str) in __hists__scnprintf_title()
2890 printed += snprintf(bf + printed, size - printed, in __hists__scnprintf_title()
2891 ", UID: %s", hists->uid_filter_str); in __hists__scnprintf_title()
2894 printed += scnprintf(bf + printed, size - printed, in __hists__scnprintf_title()
2899 printed += scnprintf(bf + printed, size - printed, in __hists__scnprintf_title()
2905 printed += scnprintf(bf + printed, size - printed, in __hists__scnprintf_title()
2907 if (socket_id > -1) in __hists__scnprintf_title()
2908 printed += scnprintf(bf + printed, size - printed, in __hists__scnprintf_title()
2923 return -1; in parse_filter_percentage()
2940 hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT_CACHED; in __hists__init()
2941 hists->entries_in = &hists->entries_in_array[0]; in __hists__init()
2942 hists->entries_collapsed = RB_ROOT_CACHED; in __hists__init()
2943 hists->entries = RB_ROOT_CACHED; in __hists__init()
2944 mutex_init(&hists->lock); in __hists__init()
2945 hists->socket_filter = -1; in __hists__init()
2946 hists->parallelism_filter = symbol_conf.parallelism_filter; in __hists__init()
2947 hists->hpp_list = hpp_list; in __hists__init()
2948 INIT_LIST_HEAD(&hists->hpp_formats); in __hists__init()
2957 while (!RB_EMPTY_ROOT(&root->rb_root)) { in hists__delete_remaining_entries()
2969 hists__delete_remaining_entries(&hists->entries_in_array[0]); in hists__delete_all_entries()
2970 hists__delete_remaining_entries(&hists->entries_in_array[1]); in hists__delete_all_entries()
2971 hists__delete_remaining_entries(&hists->entries_collapsed); in hists__delete_all_entries()
2982 list_for_each_entry_safe(node, tmp, &hists->hpp_formats, list) { in hists_evsel__exit()
2983 perf_hpp_list__for_each_format_safe(&node->hpp, fmt, pos) { in hists_evsel__exit()
2984 list_del_init(&fmt->list); in hists_evsel__exit()
2987 list_del_init(&node->list); in hists_evsel__exit()
3017 INIT_LIST_HEAD(&list->fields); in perf_hpp_list__init()
3018 INIT_LIST_HEAD(&list->sorts); in perf_hpp_list__init()