diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-16 11:35:07 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-17 14:45:55 -0400 |
commit | cc5edb0eb9ce892b530e34a5d110382483587942 (patch) | |
tree | ce06257ef9aa4dc715962913f657802c730abf2b /tools | |
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')
-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 68d288c975de..7b5848ce1505 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -795,6 +795,21 @@ enum hist_filter { | |||
795 | HIST_FILTER__THREAD, | 795 | HIST_FILTER__THREAD, |
796 | }; | 796 | }; |
797 | 797 | ||
798 | static void hists__remove_entry_filter(struct hists *self, struct hist_entry *h, | ||
799 | enum hist_filter filter) | ||
800 | { | ||
801 | h->filtered &= ~(1 << filter); | ||
802 | if (h->filtered) | ||
803 | return; | ||
804 | |||
805 | ++self->nr_entries; | ||
806 | self->stats.total_period += h->period; | ||
807 | self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; | ||
808 | |||
809 | if (h->ms.sym && self->max_sym_namelen < h->ms.sym->namelen) | ||
810 | self->max_sym_namelen = h->ms.sym->namelen; | ||
811 | } | ||
812 | |||
798 | void hists__filter_by_dso(struct hists *self, const struct dso *dso) | 813 | void hists__filter_by_dso(struct hists *self, const struct dso *dso) |
799 | { | 814 | { |
800 | struct rb_node *nd; | 815 | struct rb_node *nd; |
@@ -814,15 +829,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso) | |||
814 | continue; | 829 | continue; |
815 | } | 830 | } |
816 | 831 | ||
817 | h->filtered &= ~(1 << HIST_FILTER__DSO); | 832 | hists__remove_entry_filter(self, h, HIST_FILTER__DSO); |
818 | if (!h->filtered) { | ||
819 | ++self->nr_entries; | ||
820 | self->stats.total_period += h->period; | ||
821 | self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; | ||
822 | if (h->ms.sym && | ||
823 | self->max_sym_namelen < h->ms.sym->namelen) | ||
824 | self->max_sym_namelen = h->ms.sym->namelen; | ||
825 | } | ||
826 | } | 833 | } |
827 | } | 834 | } |
828 | 835 | ||
@@ -841,15 +848,8 @@ void hists__filter_by_thread(struct hists *self, const struct thread *thread) | |||
841 | h->filtered |= (1 << HIST_FILTER__THREAD); | 848 | h->filtered |= (1 << HIST_FILTER__THREAD); |
842 | continue; | 849 | continue; |
843 | } | 850 | } |
844 | h->filtered &= ~(1 << HIST_FILTER__THREAD); | 851 | |
845 | if (!h->filtered) { | 852 | hists__remove_entry_filter(self, h, HIST_FILTER__THREAD); |
846 | ++self->nr_entries; | ||
847 | self->stats.total_period += h->period; | ||
848 | self->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; | ||
849 | if (h->ms.sym && | ||
850 | self->max_sym_namelen < h->ms.sym->namelen) | ||
851 | self->max_sym_namelen = h->ms.sym->namelen; | ||
852 | } | ||
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||