Lines Matching defs:he
39 struct hist_entry *he);
41 struct hist_entry *he);
43 struct hist_entry *he);
45 struct hist_entry *he);
333 static void hists__delete_entry(struct hists *hists, struct hist_entry *he);
335 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
337 u64 prev_period = he->stat.period;
343 he_stat__decay(&he->stat);
345 he_stat__decay(he->stat_acc);
346 decay_callchain(he->callchain);
348 diff = prev_period - he->stat.period;
350 if (!he->depth) {
352 if (!he->filtered)
356 if (!he->leaf) {
358 struct rb_node *node = rb_first_cached(&he->hroot_out);
368 return he->stat.period == 0;
371 static void hists__delete_entry(struct hists *hists, struct hist_entry *he)
376 if (he->parent_he) {
377 root_in = &he->parent_he->hroot_in;
378 root_out = &he->parent_he->hroot_out;
387 rb_erase_cached(&he->rb_node_in, root_in);
388 rb_erase_cached(&he->rb_node, root_out);
391 if (!he->filtered)
394 hist_entry__delete(he);
448 static int hist_entry__init(struct hist_entry *he,
453 *he = *template;
454 he->callchain_size = callchain_size;
457 he->stat_acc = malloc(sizeof(he->stat));
458 if (he->stat_acc == NULL)
460 memcpy(he->stat_acc, &he->stat, sizeof(he->stat));
462 memset(&he->stat, 0, sizeof(he->stat));
465 he->ms.maps = maps__get(he->ms.maps);
466 he->ms.map = map__get(he->ms.map);
468 if (he->branch_info) {
474 he->branch_info = malloc(sizeof(*he->branch_info));
475 if (he->branch_info == NULL)
478 memcpy(he->branch_info, template->branch_info,
479 sizeof(*he->branch_info));
481 he->branch_info->from.ms.maps = maps__get(he->branch_info->from.ms.maps);
482 he->branch_info->from.ms.map = map__get(he->branch_info->from.ms.map);
483 he->branch_info->to.ms.maps = maps__get(he->branch_info->to.ms.maps);
484 he->branch_info->to.ms.map = map__get(he->branch_info->to.ms.map);
487 if (he->mem_info) {
488 he->mem_info = mem_info__clone(template->mem_info);
489 if (he->mem_info == NULL)
493 if (hist_entry__has_callchains(he) && symbol_conf.use_callchain)
494 callchain_init(he->callchain);
496 if (he->raw_data) {
497 he->raw_data = memdup(he->raw_data, he->raw_size);
498 if (he->raw_data == NULL)
502 if (he->srcline && he->srcline != SRCLINE_UNKNOWN) {
503 he->srcline = strdup(he->srcline);
504 if (he->srcline == NULL)
509 he->res_samples = calloc(symbol_conf.res_sample,
511 if (!he->res_samples)
515 INIT_LIST_HEAD(&he->pairs.node);
516 he->thread = thread__get(he->thread);
517 he->hroot_in = RB_ROOT_CACHED;
518 he->hroot_out = RB_ROOT_CACHED;
521 he->leaf = true;
526 zfree(&he->srcline);
529 zfree(&he->raw_data);
532 if (he->branch_info) {
533 map_symbol__exit(&he->branch_info->from.ms);
534 map_symbol__exit(&he->branch_info->to.ms);
535 zfree(&he->branch_info);
537 if (he->mem_info) {
538 map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms);
539 map_symbol__exit(&mem_info__daddr(he->mem_info)->ms);
542 map_symbol__exit(&he->ms);
543 zfree(&he->stat_acc);
567 struct hist_entry *he;
576 he = ops->new(callchain_size);
577 if (he) {
578 err = hist_entry__init(he, template, sample_self, callchain_size);
580 ops->free(he);
581 he = NULL;
584 return he;
594 static void hist_entry__add_callchain_period(struct hist_entry *he, u64 period)
596 if (!hist_entry__has_callchains(he) || !symbol_conf.use_callchain)
599 he->hists->callchain_period += period;
600 if (!he->filtered)
601 he->hists->callchain_non_filtered_period += period;
611 struct hist_entry *he;
620 he = rb_entry(parent, struct hist_entry, rb_node_in);
628 cmp = hist_entry__cmp(he, entry);
631 he_stat__add_stat(&he->stat, &entry->stat);
632 hist_entry__add_callchain_period(he, period);
635 he_stat__add_period(he->stat_acc, period);
647 if (hists__has(hists, sym) && he->ms.map != entry->ms.map) {
648 if (he->ms.sym) {
649 u64 addr = he->ms.sym->start;
650 he->ms.sym = map__find_symbol(entry->ms.map, addr);
653 map__put(he->ms.map);
654 he->ms.map = map__get(entry->ms.map);
667 he = hist_entry__new(entry, sample_self);
668 if (!he)
672 hist_entry__add_callchain_period(he, period);
675 rb_link_node(&he->rb_node_in, parent, p);
676 rb_insert_color_cached(&he->rb_node_in, hists->entries_in, leftmost);
679 he_stat__add_cpumode_period(&he->stat, al->cpumode, period);
681 he_stat__add_cpumode_period(he->stat_acc, al->cpumode, period);
682 return he;
695 static void hists__res_sample(struct hist_entry *he, struct perf_sample *sample)
700 if (he->num_res < symbol_conf.res_sample) {
701 j = he->num_res++;
705 r = &he->res_samples[j];
767 }, *he = hists__findnew_entry(hists, &entry, al, sample_self);
769 if (!hists->has_callchains && he && he->callchain_size != 0)
771 if (he && symbol_conf.res_sample)
772 hists__res_sample(he, sample);
773 return he;
815 }, *he = hists__findnew_entry(hists, &entry, al, false);
817 return he;
855 struct hist_entry *he;
873 he = hists__add_entry(hists, al, iter->parent, NULL, mi, NULL,
875 if (!he)
878 iter->he = he;
888 struct hist_entry *he = iter->he;
891 if (he == NULL)
894 hists__inc_nr_samples(hists, he->filtered);
896 err = hist_entry__append_callchain(he, iter->sample);
901 iter->he = NULL;
957 struct hist_entry *he = NULL;
973 he = hists__add_entry(hists, al, iter->parent, &bi[i], NULL, NULL,
975 if (he == NULL)
978 hists__inc_nr_samples(hists, he->filtered);
981 iter->he = he;
1002 iter->he = NULL;
1019 struct hist_entry *he;
1021 he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
1023 if (he == NULL)
1026 iter->he = he;
1034 struct hist_entry *he = iter->he;
1038 if (he == NULL)
1041 iter->he = NULL;
1043 hists__inc_nr_samples(evsel__hists(evsel), he->filtered);
1045 return hist_entry__append_callchain(he, sample);
1083 struct hist_entry *he;
1086 he = hists__add_entry(hists, al, iter->parent, NULL, NULL, NULL,
1088 if (he == NULL)
1091 iter->he = he;
1092 he_cache[iter->curr++] = he;
1094 hist_entry__append_callchain(he, sample);
1102 hists__inc_nr_samples(hists, he->filtered);
1141 struct hist_entry *he;
1184 iter->he = NULL;
1189 he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
1191 if (he == NULL)
1194 iter->he = he;
1195 he_cache[iter->curr++] = he;
1197 if (hist_entry__has_callchains(he) && symbol_conf.use_callchain)
1198 callchain_append(he->callchain, &cursor, sample->period);
1209 iter->he = NULL;
1270 if (iter->he && iter->add_entry_cb) {
1281 if (iter->he && iter->add_entry_cb) {
1364 void hist_entry__delete(struct hist_entry *he)
1366 struct hist_entry_ops *ops = he->ops;
1368 thread__zput(he->thread);
1369 map_symbol__exit(&he->ms);
1371 if (he->branch_info) {
1372 branch_info__exit(he->branch_info);
1373 zfree(&he->branch_info);
1376 if (he->mem_info) {
1377 map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms);
1378 map_symbol__exit(&mem_info__daddr(he->mem_info)->ms);
1379 mem_info__zput(he->mem_info);
1382 if (he->block_info)
1383 block_info__delete(he->block_info);
1385 if (he->kvm_info)
1386 kvm_info__zput(he->kvm_info);
1388 zfree(&he->res_samples);
1389 zfree(&he->stat_acc);
1390 zfree_srcline(&he->srcline);
1391 if (he->srcfile && he->srcfile[0])
1392 zfree(&he->srcfile);
1393 free_callchain(he->callchain);
1394 zfree(&he->trace_output);
1395 zfree(&he->raw_data);
1396 ops->free(he);
1406 int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp,
1409 if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) {
1410 const int width = fmt->width(fmt, hpp, he->hists);
1424 static void hists__apply_filters(struct hists *hists, struct hist_entry *he);
1425 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *he,
1435 static void hist_entry__check_and_remove_filter(struct hist_entry *he,
1441 struct hist_entry *parent = he->parent_he;
1468 perf_hpp_list__for_each_format(he->hpp_list, fmt) {
1482 if (!(he->filtered & (1 << type))) {
1499 he->filtered |= (1 << type);
1501 he->filtered |= (parent->filtered & (1 << type));
1505 static void hist_entry__apply_hierarchy_filters(struct hist_entry *he)
1507 hist_entry__check_and_remove_filter(he, HIST_FILTER__THREAD,
1510 hist_entry__check_and_remove_filter(he, HIST_FILTER__DSO,
1513 hist_entry__check_and_remove_filter(he, HIST_FILTER__SYMBOL,
1516 hists__apply_filters(he->hists, he);
1521 struct hist_entry *he,
1535 cmp = hist_entry__collapse_hierarchy(hpp_list, iter, he);
1537 he_stat__add_stat(&iter->stat, &he->stat);
1549 new = hist_entry__new(he, true);
1564 he->trace_output = NULL;
1569 he->srcline = NULL;
1574 he->srcfile = NULL;
1586 struct hist_entry *he)
1599 /* insert copy of 'he' for each fmt into the hierarchy */
1600 new_he = hierarchy_insert_entry(hists, root, he, parent, &node->hpp);
1624 he->callchain) < 0)
1629 /* 'he' is no longer used */
1630 hist_entry__delete(he);
1638 struct hist_entry *he)
1647 return hists__hierarchy_insert_entry(hists, root, he);
1653 cmp = hist_entry__collapse(iter, he);
1658 he_stat__add_stat(&iter->stat, &he->stat);
1660 he_stat__add_stat(iter->stat_acc, he->stat_acc);
1662 if (hist_entry__has_callchains(he) && symbol_conf.use_callchain) {
1667 if (callchain_merge(cursor, iter->callchain, he->callchain) < 0)
1673 hist_entry__delete(he);
1686 rb_link_node(&he->rb_node_in, parent, p);
1687 rb_insert_color_cached(&he->rb_node_in, root, leftmost);
1706 static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
1708 hists__filter_entry_by_dso(hists, he);
1709 hists__filter_entry_by_thread(hists, he);
1710 hists__filter_entry_by_symbol(hists, he);
1711 hists__filter_entry_by_socket(hists, he);
1787 struct hist_entry *he;
1800 he = rb_entry(node, struct hist_entry, rb_node);
1803 hists->stats.total_period += he->stat.period;
1804 if (!he->filtered)
1805 hists->stats.total_non_filtered_period += he->stat.period;
1810 struct hist_entry *he)
1822 if (hist_entry__sort(he, iter) > 0)
1830 rb_link_node(&he->rb_node, parent, p);
1831 rb_insert_color_cached(&he->rb_node, root, leftmost);
1834 perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) {
1836 fmt->init(fmt, he);
1848 struct hist_entry *he;
1854 he = rb_entry(node, struct hist_entry, rb_node_in);
1857 hierarchy_insert_output_entry(root_out, he);
1863 if (!he->filtered) {
1865 hists__calc_col_len(hists, he);
1868 if (!he->leaf) {
1870 &he->hroot_in,
1871 &he->hroot_out,
1881 u64 total = he->stat.period;
1884 total = he->stat_acc->period;
1889 callchain_param.sort(&he->sorted_chain, he->callchain,
1895 struct hist_entry *he,
1907 u64 total = he->stat.period;
1910 total = he->stat_acc->period;
1914 callchain_param.sort(&he->sorted_chain, he->callchain,
1922 if (hist_entry__sort(he, iter) > 0)
1930 rb_link_node(&he->rb_node, parent, p);
1931 rb_insert_color_cached(&he->rb_node, entries, leftmost);
1936 fmt->init(fmt, he);
2026 static bool can_goto_child(struct hist_entry *he, enum hierarchy_move_dir hmd)
2028 if (he->leaf || hmd == HMD_FORCE_SIBLING)
2031 if (he->unfolded || hmd == HMD_FORCE_CHILD)
2039 struct hist_entry *he = rb_entry(node, struct hist_entry, rb_node);
2041 while (can_goto_child(he, HMD_NORMAL)) {
2042 node = rb_last(&he->hroot_out.rb_root);
2043 he = rb_entry(node, struct hist_entry, rb_node);
2050 struct hist_entry *he = rb_entry(node, struct hist_entry, rb_node);
2052 if (can_goto_child(he, hmd))
2053 node = rb_first_cached(&he->hroot_out);
2058 he = he->parent_he;
2059 if (he == NULL)
2062 node = rb_next(&he->rb_node);
2069 struct hist_entry *he = rb_entry(node, struct hist_entry, rb_node);
2075 he = he->parent_he;
2076 if (he == NULL)
2079 return &he->rb_node;
2082 bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit)
2088 if (he->leaf)
2091 node = rb_first_cached(&he->hroot_out);
2150 struct hist_entry *he)
2153 (he->ms.map == NULL || !RC_CHK_EQUAL(map__dso(he->ms.map), hists->dso_filter))) {
2154 he->filtered |= (1 << HIST_FILTER__DSO);
2162 struct hist_entry *he)
2165 !RC_CHK_EQUAL(he->thread, hists->thread_filter)) {
2166 he->filtered |= (1 << HIST_FILTER__THREAD);
2174 struct hist_entry *he)
2177 (!he->ms.sym || strstr(he->ms.sym->name,
2179 he->filtered |= (1 << HIST_FILTER__SYMBOL);
2187 struct hist_entry *he)
2190 (he->socket != hists->socket_filter)) {
2191 he->filtered |= (1 << HIST_FILTER__SOCKET);
2198 typedef bool (*filter_fn_t)(struct hists *hists, struct hist_entry *he);
2220 struct hist_entry *he)
2233 if (hist_entry__sort(he, iter) > 0)
2241 rb_link_node(&he->rb_node, parent, p);
2242 rb_insert_color_cached(&he->rb_node, root, leftmost);
2244 if (he->leaf || he->filtered)
2247 nd = rb_first_cached(&he->hroot_out);
2252 rb_erase_cached(&h->rb_node, &he->hroot_out);
2257 he->hroot_out = new_root;
2406 struct hist_entry *he;
2419 he = rb_entry(parent, struct hist_entry, rb_node_in);
2421 cmp = hist_entry__collapse(he, pair);
2434 he = hist_entry__new(pair, true);
2435 if (he) {
2436 memset(&he->stat, 0, sizeof(he->stat));
2437 he->hists = hists;
2439 memset(he->stat_acc, 0, sizeof(he->stat));
2440 rb_link_node(&he->rb_node_in, parent, p);
2441 rb_insert_color_cached(&he->rb_node_in, root, leftmost);
2442 hists__inc_stats(hists, he);
2443 he->dummy = true;
2446 return he;
2455 struct hist_entry *he;
2463 he = rb_entry(parent, struct hist_entry, rb_node_in);
2464 cmp = hist_entry__collapse_hierarchy(he->hpp_list, he, pair);
2476 he = hist_entry__new(pair, true);
2477 if (he) {
2478 rb_link_node(&he->rb_node_in, parent, p);
2479 rb_insert_color_cached(&he->rb_node_in, root, leftmost);
2481 he->dummy = true;
2482 he->hists = hists;
2483 memset(&he->stat, 0, sizeof(he->stat));
2484 hists__inc_stats(hists, he);
2487 return he;
2491 struct hist_entry *he)
2502 int64_t cmp = hist_entry__collapse(iter, he);
2516 struct hist_entry *he)
2525 cmp = hist_entry__collapse_hierarchy(he->hpp_list, iter, he);
2881 struct hist_entry *he;
2887 he = rb_entry(node, struct hist_entry, rb_node_in);
2888 hist_entry__delete(he);