perf hist: Adopt filter by dso and by thread methods from the newt browser
[pandora-kernel.git] / tools / perf / util / hist.c
index 2be33c7..baa55be 100644 (file)
@@ -8,22 +8,65 @@ struct callchain_param        callchain_param = {
        .min_percent = 0.5
 };
 
+static void hist_entry__add_cpumode_count(struct hist_entry *self,
+                                         unsigned int cpumode, u64 count)
+{
+       switch (cpumode) {
+       case PERF_RECORD_MISC_KERNEL:
+               self->count_sys += count;
+               break;
+       case PERF_RECORD_MISC_USER:
+               self->count_us += count;
+               break;
+       case PERF_RECORD_MISC_GUEST_KERNEL:
+               self->count_guest_sys += count;
+               break;
+       case PERF_RECORD_MISC_GUEST_USER:
+               self->count_guest_us += count;
+               break;
+       default:
+               break;
+       }
+}
+
 /*
  * histogram, sorted on item, collects counts
  */
 
-struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
-                                                 struct addr_location *al,
-                                                 struct symbol *sym_parent,
-                                                 u64 count, bool *hit)
+static struct hist_entry *hist_entry__new(struct hist_entry *template)
+{
+       size_t callchain_size = symbol_conf.use_callchain ? sizeof(struct callchain_node) : 0;
+       struct hist_entry *self = malloc(sizeof(*self) + callchain_size);
+
+       if (self != NULL) {
+               *self = *template;
+               if (symbol_conf.use_callchain)
+                       callchain_init(self->callchain);
+       }
+
+       return self;
+}
+
+static void hists__inc_nr_entries(struct hists *self, struct hist_entry *entry)
 {
-       struct rb_node **p = &hists->rb_node;
+       if (entry->ms.sym && self->max_sym_namelen < entry->ms.sym->namelen)
+               self->max_sym_namelen = entry->ms.sym->namelen;
+       ++self->nr_entries;
+}
+
+struct hist_entry *__hists__add_entry(struct hists *self,
+                                     struct addr_location *al,
+                                     struct symbol *sym_parent, u64 count)
+{
+       struct rb_node **p = &self->entries.rb_node;
        struct rb_node *parent = NULL;
        struct hist_entry *he;
        struct hist_entry entry = {
                .thread = al->thread,
-               .map    = al->map,
-               .sym    = al->sym,
+               .ms = {
+                       .map    = al->map,
+                       .sym    = al->sym,
+               },
                .ip     = al->addr,
                .level  = al->level,
                .count  = count,
@@ -38,8 +81,8 @@ struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
                cmp = hist_entry__cmp(&entry, he);
 
                if (!cmp) {
-                       *hit = true;
-                       return he;
+                       he->count += count;
+                       goto out;
                }
 
                if (cmp < 0)
@@ -48,13 +91,14 @@ struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
                        p = &(*p)->rb_right;
        }
 
-       he = malloc(sizeof(*he));
+       he = hist_entry__new(&entry);
        if (!he)
                return NULL;
-       *he = entry;
        rb_link_node(&he->rb_node, parent, p);
-       rb_insert_color(&he->rb_node, hists);
-       *hit = false;
+       rb_insert_color(&he->rb_node, &self->entries);
+       hists__inc_nr_entries(self, he);
+out:
+       hist_entry__add_cpumode_count(he, al->cpumode, count);
        return he;
 }
 
@@ -65,7 +109,7 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
        int64_t cmp = 0;
 
        list_for_each_entry(se, &hist_entry__sort_list, list) {
-               cmp = se->cmp(left, right);
+               cmp = se->se_cmp(left, right);
                if (cmp)
                        break;
        }
@@ -82,7 +126,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
        list_for_each_entry(se, &hist_entry__sort_list, list) {
                int64_t (*f)(struct hist_entry *, struct hist_entry *);
 
-               f = se->collapse ?: se->cmp;
+               f = se->se_collapse ?: se->se_cmp;
 
                cmp = f(left, right);
                if (cmp)
@@ -101,7 +145,7 @@ void hist_entry__free(struct hist_entry *he)
  * collapse the histogram
  */
 
-static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
+static bool collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
 {
        struct rb_node **p = &root->rb_node;
        struct rb_node *parent = NULL;
@@ -117,7 +161,7 @@ static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
                if (!cmp) {
                        iter->count += he->count;
                        hist_entry__free(he);
-                       return;
+                       return false;
                }
 
                if (cmp < 0)
@@ -128,9 +172,10 @@ static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
 
        rb_link_node(&he->rb_node, parent, p);
        rb_insert_color(&he->rb_node, root);
+       return true;
 }
 
-void perf_session__collapse_resort(struct rb_root *hists)
+void hists__collapse_resort(struct hists *self)
 {
        struct rb_root tmp;
        struct rb_node *next;
@@ -140,33 +185,36 @@ void perf_session__collapse_resort(struct rb_root *hists)
                return;
 
        tmp = RB_ROOT;
-       next = rb_first(hists);
+       next = rb_first(&self->entries);
+       self->nr_entries = 0;
+       self->max_sym_namelen = 0;
 
        while (next) {
                n = rb_entry(next, struct hist_entry, rb_node);
                next = rb_next(&n->rb_node);
 
-               rb_erase(&n->rb_node, hists);
-               collapse__insert_entry(&tmp, n);
+               rb_erase(&n->rb_node, &self->entries);
+               if (collapse__insert_entry(&tmp, n))
+                       hists__inc_nr_entries(self, n);
        }
 
-       *hists = tmp;
+       self->entries = tmp;
 }
 
 /*
  * reverse the map, sort on count.
  */
 
-static void perf_session__insert_output_hist_entry(struct rb_root *root,
-                                                  struct hist_entry *he,
-                                                  u64 min_callchain_hits)
+static void __hists__insert_output_entry(struct rb_root *entries,
+                                        struct hist_entry *he,
+                                        u64 min_callchain_hits)
 {
-       struct rb_node **p = &root->rb_node;
+       struct rb_node **p = &entries->rb_node;
        struct rb_node *parent = NULL;
        struct hist_entry *iter;
 
        if (symbol_conf.use_callchain)
-               callchain_param.sort(&he->sorted_chain, &he->callchain,
+               callchain_param.sort(&he->sorted_chain, he->callchain,
                                      min_callchain_hits, &callchain_param);
 
        while (*p != NULL) {
@@ -180,32 +228,34 @@ static void perf_session__insert_output_hist_entry(struct rb_root *root,
        }
 
        rb_link_node(&he->rb_node, parent, p);
-       rb_insert_color(&he->rb_node, root);
+       rb_insert_color(&he->rb_node, entries);
 }
 
-void perf_session__output_resort(struct rb_root *hists, u64 total_samples)
+void hists__output_resort(struct hists *self)
 {
        struct rb_root tmp;
        struct rb_node *next;
        struct hist_entry *n;
        u64 min_callchain_hits;
 
-       min_callchain_hits =
-               total_samples * (callchain_param.min_percent / 100);
+       min_callchain_hits = self->stats.total * (callchain_param.min_percent / 100);
 
        tmp = RB_ROOT;
-       next = rb_first(hists);
+       next = rb_first(&self->entries);
+
+       self->nr_entries = 0;
+       self->max_sym_namelen = 0;
 
        while (next) {
                n = rb_entry(next, struct hist_entry, rb_node);
                next = rb_next(&n->rb_node);
 
-               rb_erase(&n->rb_node, hists);
-               perf_session__insert_output_hist_entry(&tmp, n,
-                                                      min_callchain_hits);
+               rb_erase(&n->rb_node, &self->entries);
+               __hists__insert_output_entry(&tmp, n, min_callchain_hits);
+               hists__inc_nr_entries(self, n);
        }
 
-       *hists = tmp;
+       self->entries = tmp;
 }
 
 static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
@@ -258,8 +308,8 @@ static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain,
                } else
                        ret += fprintf(fp, "%s", "          ");
        }
-       if (chain->sym)
-               ret += fprintf(fp, "%s\n", chain->sym->name);
+       if (chain->ms.sym)
+               ret += fprintf(fp, "%s\n", chain->ms.sym->name);
        else
                ret += fprintf(fp, "%p\n", (void *)(long)chain->ip);
 
@@ -278,7 +328,7 @@ static void init_rem_hits(void)
        }
 
        strcpy(rem_sq_bracket->name, "[...]");
-       rem_hits.sym = rem_sq_bracket;
+       rem_hits.ms.sym = rem_sq_bracket;
 }
 
 static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
@@ -293,6 +343,7 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
        u64 remaining;
        size_t ret = 0;
        int i;
+       uint entries_printed = 0;
 
        if (callchain_param.mode == CHAIN_GRAPH_REL)
                new_total = self->children_hit;
@@ -328,8 +379,6 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
                                                   left_margin);
                i = 0;
                list_for_each_entry(chain, &child->val, list) {
-                       if (chain->ip >= PERF_CONTEXT_MAX)
-                               continue;
                        ret += ipchain__fprintf_graph(fp, chain, depth,
                                                      new_depth_mask, i++,
                                                      new_total,
@@ -341,6 +390,8 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
                                                  new_depth_mask | (1 << depth),
                                                  left_margin);
                node = next;
+               if (++entries_printed == callchain_param.print_limit)
+                       break;
        }
 
        if (callchain_param.mode == CHAIN_GRAPH_REL &&
@@ -366,11 +417,9 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
        bool printed = false;
        int i = 0;
        int ret = 0;
+       u32 entries_printed = 0;
 
        list_for_each_entry(chain, &self->val, list) {
-               if (chain->ip >= PERF_CONTEXT_MAX)
-                       continue;
-
                if (!i++ && sort__first_dimension == SORT_SYM)
                        continue;
 
@@ -385,10 +434,13 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
                } else
                        ret += callchain__fprintf_left_margin(fp, left_margin);
 
-               if (chain->sym)
-                       ret += fprintf(fp, " %s\n", chain->sym->name);
+               if (chain->ms.sym)
+                       ret += fprintf(fp, " %s\n", chain->ms.sym->name);
                else
                        ret += fprintf(fp, " %p\n", (void *)(long)chain->ip);
+
+               if (++entries_printed == callchain_param.print_limit)
+                       break;
        }
 
        ret += __callchain__fprintf_graph(fp, self, total_samples, 1, 1, left_margin);
@@ -411,8 +463,8 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self,
        list_for_each_entry(chain, &self->val, list) {
                if (chain->ip >= PERF_CONTEXT_MAX)
                        continue;
-               if (chain->sym)
-                       ret += fprintf(fp, "                %s\n", chain->sym->name);
+               if (chain->ms.sym)
+                       ret += fprintf(fp, "                %s\n", chain->ms.sym->name);
                else
                        ret += fprintf(fp, "                %p\n",
                                        (void *)(long)chain->ip);
@@ -427,6 +479,7 @@ static size_t hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
        struct rb_node *rb_node;
        struct callchain_node *chain;
        size_t ret = 0;
+       u32 entries_printed = 0;
 
        rb_node = rb_first(&self->sorted_chain);
        while (rb_node) {
@@ -449,48 +502,81 @@ static size_t hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
                        break;
                }
                ret += fprintf(fp, "\n");
+               if (++entries_printed == callchain_param.print_limit)
+                       break;
                rb_node = rb_next(rb_node);
        }
 
        return ret;
 }
 
-static size_t hist_entry__fprintf(struct hist_entry *self,
-                                 struct perf_session *pair_session,
-                                 bool show_displacement,
-                                 long displacement, FILE *fp,
-                                 u64 session_total)
+int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
+                        struct hists *pair_hists, bool show_displacement,
+                        long displacement, bool color, u64 session_total)
 {
        struct sort_entry *se;
-       u64 count, total;
+       u64 count, total, count_sys, count_us, count_guest_sys, count_guest_us;
        const char *sep = symbol_conf.field_sep;
-       size_t ret;
+       int ret;
 
        if (symbol_conf.exclude_other && !self->parent)
                return 0;
 
-       if (pair_session) {
+       if (pair_hists) {
                count = self->pair ? self->pair->count : 0;
-               total = pair_session->events_stats.total;
+               total = pair_hists->stats.total;
+               count_sys = self->pair ? self->pair->count_sys : 0;
+               count_us = self->pair ? self->pair->count_us : 0;
+               count_guest_sys = self->pair ? self->pair->count_guest_sys : 0;
+               count_guest_us = self->pair ? self->pair->count_guest_us : 0;
        } else {
                count = self->count;
                total = session_total;
+               count_sys = self->count_sys;
+               count_us = self->count_us;
+               count_guest_sys = self->count_guest_sys;
+               count_guest_us = self->count_guest_us;
        }
 
-       if (total)
-               ret = percent_color_fprintf(fp, sep ? "%.2f" : "   %6.2f%%",
-                                           (count * 100.0) / total);
-       else
-               ret = fprintf(fp, sep ? "%lld" : "%12lld ", count);
+       if (total) {
+               if (color)
+                       ret = percent_color_snprintf(s, size,
+                                                    sep ? "%.2f" : "   %6.2f%%",
+                                                    (count * 100.0) / total);
+               else
+                       ret = snprintf(s, size, sep ? "%.2f" : "   %6.2f%%",
+                                      (count * 100.0) / total);
+               if (symbol_conf.show_cpu_utilization) {
+                       ret += percent_color_snprintf(s + ret, size - ret,
+                                       sep ? "%.2f" : "   %6.2f%%",
+                                       (count_sys * 100.0) / total);
+                       ret += percent_color_snprintf(s + ret, size - ret,
+                                       sep ? "%.2f" : "   %6.2f%%",
+                                       (count_us * 100.0) / total);
+                       if (perf_guest) {
+                               ret += percent_color_snprintf(s + ret,
+                                               size - ret,
+                                               sep ? "%.2f" : "   %6.2f%%",
+                                               (count_guest_sys * 100.0) /
+                                                               total);
+                               ret += percent_color_snprintf(s + ret,
+                                               size - ret,
+                                               sep ? "%.2f" : "   %6.2f%%",
+                                               (count_guest_us * 100.0) /
+                                                               total);
+                       }
+               }
+       } else
+               ret = snprintf(s, size, sep ? "%lld" : "%12lld ", count);
 
        if (symbol_conf.show_nr_samples) {
                if (sep)
-                       fprintf(fp, "%c%lld", *sep, count);
+                       ret += snprintf(s + ret, size - ret, "%c%lld", *sep, count);
                else
-                       fprintf(fp, "%11lld", count);
+                       ret += snprintf(s + ret, size - ret, "%11lld", count);
        }
 
-       if (pair_session) {
+       if (pair_hists) {
                char bf[32];
                double old_percent = 0, new_percent = 0, diff;
 
@@ -507,9 +593,9 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
                        snprintf(bf, sizeof(bf), " ");
 
                if (sep)
-                       ret += fprintf(fp, "%c%s", *sep, bf);
+                       ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf);
                else
-                       ret += fprintf(fp, "%11.11s", bf);
+                       ret += snprintf(s + ret, size - ret, "%11.11s", bf);
 
                if (show_displacement) {
                        if (displacement)
@@ -518,9 +604,9 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
                                snprintf(bf, sizeof(bf), " ");
 
                        if (sep)
-                               fprintf(fp, "%c%s", *sep, bf);
+                               ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf);
                        else
-                               fprintf(fp, "%6.6s", bf);
+                               ret += snprintf(s + ret, size - ret, "%6.6s", bf);
                }
        }
 
@@ -528,33 +614,43 @@ static size_t hist_entry__fprintf(struct hist_entry *self,
                if (se->elide)
                        continue;
 
-               fprintf(fp, "%s", sep ?: "  ");
-               ret += se->print(fp, self, se->width ? *se->width : 0);
+               ret += snprintf(s + ret, size - ret, "%s", sep ?: "  ");
+               ret += se->se_snprintf(self, s + ret, size - ret,
+                                      se->se_width ? *se->se_width : 0);
        }
 
-       ret += fprintf(fp, "\n");
+       return ret;
+}
 
-       if (symbol_conf.use_callchain) {
-               int left_margin = 0;
+int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
+                       bool show_displacement, long displacement, FILE *fp,
+                       u64 session_total)
+{
+       char bf[512];
+       hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
+                            show_displacement, displacement,
+                            true, session_total);
+       return fprintf(fp, "%s\n", bf);
+}
 
-               if (sort__first_dimension == SORT_COMM) {
-                       se = list_first_entry(&hist_entry__sort_list, typeof(*se),
-                                               list);
-                       left_margin = se->width ? *se->width : 0;
-                       left_margin -= thread__comm_len(self->thread);
-               }
+static size_t hist_entry__fprintf_callchain(struct hist_entry *self, FILE *fp,
+                                           u64 session_total)
+{
+       int left_margin = 0;
 
-               hist_entry_callchain__fprintf(fp, self, session_total,
-                                             left_margin);
+       if (sort__first_dimension == SORT_COMM) {
+               struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
+                                                        typeof(*se), list);
+               left_margin = se->se_width ? *se->se_width : 0;
+               left_margin -= thread__comm_len(self->thread);
        }
 
-       return ret;
+       return hist_entry_callchain__fprintf(fp, self, session_total,
+                                            left_margin);
 }
 
-size_t perf_session__fprintf_hists(struct rb_root *hists,
-                                  struct perf_session *pair,
-                                  bool show_displacement, FILE *fp,
-                                  u64 session_total)
+size_t hists__fprintf(struct hists *self, struct hists *pair,
+                     bool show_displacement, FILE *fp)
 {
        struct sort_entry *se;
        struct rb_node *nd;
@@ -576,6 +672,24 @@ size_t perf_session__fprintf_hists(struct rb_root *hists,
                        fputs("  Samples  ", fp);
        }
 
+       if (symbol_conf.show_cpu_utilization) {
+               if (sep) {
+                       ret += fprintf(fp, "%csys", *sep);
+                       ret += fprintf(fp, "%cus", *sep);
+                       if (perf_guest) {
+                               ret += fprintf(fp, "%cguest sys", *sep);
+                               ret += fprintf(fp, "%cguest us", *sep);
+                       }
+               } else {
+                       ret += fprintf(fp, "  sys  ");
+                       ret += fprintf(fp, "  us  ");
+                       if (perf_guest) {
+                               ret += fprintf(fp, "  guest sys  ");
+                               ret += fprintf(fp, "  guest us  ");
+                       }
+               }
+       }
+
        if (pair) {
                if (sep)
                        ret += fprintf(fp, "%cDelta", *sep);
@@ -594,22 +708,22 @@ size_t perf_session__fprintf_hists(struct rb_root *hists,
                if (se->elide)
                        continue;
                if (sep) {
-                       fprintf(fp, "%c%s", *sep, se->header);
+                       fprintf(fp, "%c%s", *sep, se->se_header);
                        continue;
                }
-               width = strlen(se->header);
-               if (se->width) {
+               width = strlen(se->se_header);
+               if (se->se_width) {
                        if (symbol_conf.col_width_list_str) {
                                if (col_width) {
-                                       *se->width = atoi(col_width);
+                                       *se->se_width = atoi(col_width);
                                        col_width = strchr(col_width, ',');
                                        if (col_width)
                                                ++col_width;
                                }
                        }
-                       width = *se->width = max(*se->width, width);
+                       width = *se->se_width = max(*se->se_width, width);
                }
-               fprintf(fp, "  %*s", width, se->header);
+               fprintf(fp, "  %*s", width, se->se_header);
        }
        fprintf(fp, "\n");
 
@@ -631,10 +745,10 @@ size_t perf_session__fprintf_hists(struct rb_root *hists,
                        continue;
 
                fprintf(fp, "  ");
-               if (se->width)
-                       width = *se->width;
+               if (se->se_width)
+                       width = *se->se_width;
                else
-                       width = strlen(se->header);
+                       width = strlen(se->se_header);
                for (i = 0; i < width; i++)
                        fprintf(fp, ".");
        }
@@ -642,7 +756,7 @@ size_t perf_session__fprintf_hists(struct rb_root *hists,
        fprintf(fp, "\n#\n");
 
 print_entries:
-       for (nd = rb_first(hists); nd; nd = rb_next(nd)) {
+       for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
                struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
 
                if (show_displacement) {
@@ -654,10 +768,14 @@ print_entries:
                        ++position;
                }
                ret += hist_entry__fprintf(h, pair, show_displacement,
-                                          displacement, fp, session_total);
-               if (h->map == NULL && verbose > 1) {
+                                          displacement, fp, self->stats.total);
+
+               if (symbol_conf.use_callchain)
+                       ret += hist_entry__fprintf_callchain(h, fp, self->stats.total);
+
+               if (h->ms.map == NULL && verbose > 1) {
                        __map_groups__fprintf_maps(&h->thread->mg,
-                                                  MAP__FUNCTION, fp);
+                                                  MAP__FUNCTION, verbose, fp);
                        fprintf(fp, "%.10s end\n", graph_dotted_line);
                }
        }
@@ -666,3 +784,62 @@ print_entries:
 
        return ret;
 }
+
+enum hist_filter {
+       HIST_FILTER__DSO,
+       HIST_FILTER__THREAD,
+};
+
+void hists__filter_by_dso(struct hists *self, const struct dso *dso)
+{
+       struct rb_node *nd;
+
+       self->nr_entries = self->stats.total = 0;
+       self->max_sym_namelen = 0;
+
+       for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
+               struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+
+               if (symbol_conf.exclude_other && !h->parent)
+                       continue;
+
+               if (dso != NULL && (h->ms.map == NULL || h->ms.map->dso != dso)) {
+                       h->filtered |= (1 << HIST_FILTER__DSO);
+                       continue;
+               }
+
+               h->filtered &= ~(1 << HIST_FILTER__DSO);
+               if (!h->filtered) {
+                       ++self->nr_entries;
+                       self->stats.total += h->count;
+                       if (h->ms.sym &&
+                           self->max_sym_namelen < h->ms.sym->namelen)
+                               self->max_sym_namelen = h->ms.sym->namelen;
+               }
+       }
+}
+
+void hists__filter_by_thread(struct hists *self, const struct thread *thread)
+{
+       struct rb_node *nd;
+
+       self->nr_entries = self->stats.total = 0;
+       self->max_sym_namelen = 0;
+
+       for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
+               struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+
+               if (thread != NULL && h->thread != thread) {
+                       h->filtered |= (1 << HIST_FILTER__THREAD);
+                       continue;
+               }
+               h->filtered &= ~(1 << HIST_FILTER__THREAD);
+               if (!h->filtered) {
+                       ++self->nr_entries;
+                       self->stats.total += h->count;
+                       if (h->ms.sym &&
+                           self->max_sym_namelen < h->ms.sym->namelen)
+                               self->max_sym_namelen = h->ms.sym->namelen;
+               }
+       }
+}