diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-16 12:35:07 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-17 15:45:55 -0300 |
commit | cc5edb0eb9ce892b530e34a5d110382483587942 (patch) | |
tree | ce06257ef9aa4dc715962913f657802c730abf2b /tools/perf | |
parent | b66ecd97c1866f9a869643a5b69a984d5ce8f8f1 (diff) |
perf hists: Factor out duplicated code
Introducing hists__remove_entry_filter.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/hist.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 68d288c975d..7b5848ce150 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -795,6 +795,21 @@ enum hist_filter { HIST_FILTER__THREAD, }; +static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h, + enum hist_filter filter) +{ + h->filtered &= ~(1 << filter); + if (h->filtered) + return; + + ++self->nr_entries; + self->stats.total_period += h->period; + self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; + + if (h->ms.sym && self->max_sym_namelen < h->ms.sym->namelen) + self->max_sym_namelen = h->ms.sym->namelen; +} + void hists__filter_by_dso(struct hists *self, const struct dso *dso) { struct rb_node *nd; @@ -814,15 +829,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso) continue; } - h->filtered &= ~(1 << HIST_FILTER__DSO); - if (!h->filtered) { - ++self->nr_entries; - self->stats.total_period += h->period; - self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; - if (h->ms.sym && - self->max_sym_namelen < h->ms.sym->namelen) - self->max_sym_namelen = h->ms.sym->namelen; - } + hists__remove_entry_filter(self, h, HIST_FILTER__DSO); } } @@ -841,15 +848,8 @@ void hists__filter_by_thread(struct hists *self, const struct thread *thread) h->filtered |= (1 << HIST_FILTER__THREAD); continue; } - h->filtered &= ~(1 << HIST_FILTER__THREAD); - if (!h->filtered) { - ++self->nr_entries; - self->stats.total_period += h->period; - self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; - if (h->ms.sym && - self->max_sym_namelen < h->ms.sym->namelen) - self->max_sym_namelen = h->ms.sym->namelen; - } + + hists__remove_entry_filter(self, h, HIST_FILTER__THREAD); } } |