void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel) { struct rb_node *next = rb_first(&hists->entries); struct hist_entry *n; while (next) { n = rb_entry(next, struct hist_entry, rb_node); next = rb_next(&n->rb_node); /* * We may be annotating this, for instance, so keep it here in * case some it gets new samples, we'll eventually free it when * the user stops browsing and it agains gets fully decayed. */ if (((zap_user && n->level == '.') || (zap_kernel && n->level != '.') || hists__decay_entry(hists, n)) && !n->used) { rb_erase(&n->rb_node, &hists->entries); if (sort__need_collapse) rb_erase(&n->rb_node_in, &hists->entries_collapsed); --hists->nr_entries; if (!n->filtered) --hists->nr_non_filtered_entries; hist_entry__free(n); } } }
void hists__delete_entries(struct hists *hists) { struct rb_node *next = rb_first(&hists->entries); struct hist_entry *n; while (next) { n = rb_entry(next, struct hist_entry, rb_node); next = rb_next(&n->rb_node); rb_erase(&n->rb_node, &hists->entries); if (sort__need_collapse) rb_erase(&n->rb_node_in, &hists->entries_collapsed); --hists->nr_entries; if (!n->filtered) --hists->nr_non_filtered_entries; hist_entry__free(n); } }