Lines Matching refs:hists

10 static bool hists__filter_entry_by_dso(struct hists *hists,
12 static bool hists__filter_entry_by_thread(struct hists *hists,
14 static bool hists__filter_entry_by_symbol(struct hists *hists,
31 u16 hists__col_len(struct hists *hists, enum hist_column col)
33 return hists->col_len[col];
36 void hists__set_col_len(struct hists *hists, enum hist_column col, u16 len)
38 hists->col_len[col] = len;
41 bool hists__new_col_len(struct hists *hists, enum hist_column col, u16 len)
43 if (len > hists__col_len(hists, col)) {
44 hists__set_col_len(hists, col, len);
50 void hists__reset_col_len(struct hists *hists)
55 hists__set_col_len(hists, col, 0);
58 static void hists__set_unres_dso_col_len(struct hists *hists, int dso)
62 if (hists__col_len(hists, dso) < unresolved_col_width &&
65 hists__set_col_len(hists, dso, unresolved_col_width);
68 void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
83 hists__new_col_len(hists, HISTC_SYMBOL, symlen);
86 hists__new_col_len(hists, HISTC_SYMBOL, symlen);
87 hists__set_unres_dso_col_len(hists, HISTC_DSO);
91 if (hists__new_col_len(hists, HISTC_COMM, len))
92 hists__set_col_len(hists, HISTC_THREAD, len + 6);
96 hists__new_col_len(hists, HISTC_DSO, len);
100 hists__new_col_len(hists, HISTC_PARENT, h->parent->namelen);
107 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen);
110 hists__new_col_len(hists, HISTC_DSO_FROM, symlen);
113 hists__new_col_len(hists, HISTC_SYMBOL_FROM, symlen);
114 hists__set_unres_dso_col_len(hists, HISTC_DSO_FROM);
121 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen);
124 hists__new_col_len(hists, HISTC_DSO_TO, symlen);
127 hists__new_col_len(hists, HISTC_SYMBOL_TO, symlen);
128 hists__set_unres_dso_col_len(hists, HISTC_DSO_TO);
136 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
140 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
145 hists__new_col_len(hists, HISTC_MEM_DADDR_DSO,
149 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
153 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen);
154 hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
157 hists__new_col_len(hists, HISTC_MEM_LOCKED, 6);
158 hists__new_col_len(hists, HISTC_MEM_TLB, 22);
159 hists__new_col_len(hists, HISTC_MEM_SNOOP, 12);
160 hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3);
161 hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12);
162 hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12);
165 void hists__output_recalc_col_len(struct hists *hists, int max_rows)
167 struct rb_node *next = rb_first(&hists->entries);
171 hists__reset_col_len(hists);
176 hists__calc_col_len(hists, n);
229 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
239 hists->stats.total_period -= prev_period - he->stat.period;
244 void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel)
246 struct rb_node *next = rb_first(&hists->entries);
259 hists__decay_entry(hists, n)) &&
261 rb_erase(&n->rb_node, &hists->entries);
264 rb_erase(&n->rb_node_in, &hists->entries_collapsed);
267 --hists->nr_entries;
324 void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h)
327 hists__calc_col_len(hists, h);
328 ++hists->nr_entries;
329 hists->stats.total_period += h->stat.period;
340 static struct hist_entry *add_hist_entry(struct hists *hists,
351 p = &hists->entries_in->rb_node;
399 rb_insert_color(&he->rb_node_in, hists->entries_in);
405 struct hist_entry *__hists__add_mem_entry(struct hists *self,
428 .hists = self,
435 struct hist_entry *__hists__add_branch_entry(struct hists *self,
459 .hists = self,
466 struct hist_entry *__hists__add_entry(struct hists *self,
487 .hists = self,
540 static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused,
579 static struct rb_root *hists__get_rotate_entries_in(struct hists *hists)
583 pthread_mutex_lock(&hists->lock);
585 root = hists->entries_in;
586 if (++hists->entries_in > &hists->entries_in_array[1])
587 hists->entries_in = &hists->entries_in_array[0];
589 pthread_mutex_unlock(&hists->lock);
594 static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
596 hists__filter_entry_by_dso(hists, he);
597 hists__filter_entry_by_thread(hists, he);
598 hists__filter_entry_by_symbol(hists, he);
601 void hists__collapse_resort(struct hists *hists)
610 root = hists__get_rotate_entries_in(hists);
620 if (hists__collapse_insert_entry(hists, &hists->entries_collapsed, n)) {
626 hists__apply_filters(hists, n);
657 evsel = hists_to_evsel(a->hists);
669 evsel = hists_to_evsel(pair->hists);
674 evsel = hists_to_evsel(pair->hists);
717 void hists__output_resort(struct hists *hists)
724 min_callchain_hits = hists->stats.total_period * (callchain_param.min_percent / 100);
727 root = &hists->entries_collapsed;
729 root = hists->entries_in;
732 hists->entries = RB_ROOT;
734 hists->nr_entries = 0;
735 hists->stats.total_period = 0;
736 hists__reset_col_len(hists);
742 __hists__insert_output_entry(&hists->entries, n, min_callchain_hits);
743 hists__inc_nr_entries(hists, n);
747 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h,
754 ++hists->nr_entries;
756 hists->nr_entries += h->nr_rows;
758 hists->stats.total_period += h->stat.period;
759 hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->stat.nr_events;
761 hists__calc_col_len(hists, h);
765 static bool hists__filter_entry_by_dso(struct hists *hists,
768 if (hists->dso_filter != NULL &&
769 (he->ms.map == NULL || he->ms.map->dso != hists->dso_filter)) {
777 void hists__filter_by_dso(struct hists *hists)
781 hists->nr_entries = hists->stats.total_period = 0;
782 hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
783 hists__reset_col_len(hists);
785 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
791 if (hists__filter_entry_by_dso(hists, h))
794 hists__remove_entry_filter(hists, h, HIST_FILTER__DSO);
798 static bool hists__filter_entry_by_thread(struct hists *hists,
801 if (hists->thread_filter != NULL &&
802 he->thread != hists->thread_filter) {
810 void hists__filter_by_thread(struct hists *hists)
814 hists->nr_entries = hists->stats.total_period = 0;
815 hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
816 hists__reset_col_len(hists);
818 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
821 if (hists__filter_entry_by_thread(hists, h))
824 hists__remove_entry_filter(hists, h, HIST_FILTER__THREAD);
828 static bool hists__filter_entry_by_symbol(struct hists *hists,
831 if (hists->symbol_filter_str != NULL &&
833 hists->symbol_filter_str) == NULL)) {
841 void hists__filter_by_symbol(struct hists *hists)
845 hists->nr_entries = hists->stats.total_period = 0;
846 hists->stats.nr_events[PERF_RECORD_SAMPLE] = 0;
847 hists__reset_col_len(hists);
849 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
852 if (hists__filter_entry_by_symbol(hists, h))
855 hists__remove_entry_filter(hists, h, HIST_FILTER__SYMBOL);
875 void hists__inc_nr_events(struct hists *hists, u32 type)
877 events_stats__inc(&hists->stats, type);
880 static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
890 root = &hists->entries_collapsed;
892 root = hists->entries_in;
914 he->hists = hists;
917 hists__inc_nr_entries(hists, he);
924 static struct hist_entry *hists__find_entry(struct hists *hists,
930 n = hists->entries_collapsed.rb_node;
932 n = hists->entries_in->rb_node;
952 void hists__match(struct hists *leader, struct hists *other)
973 * Look for entries in the other hists that are not present in the leader, if
974 * we find them, just add a dummy entry on the leader hists, with period=0,
977 int hists__link(struct hists *leader, struct hists *other)