Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760193Ab0GRBtg (ORCPT ); Sat, 17 Jul 2010 21:49:36 -0400 Received: from casper.infradead.org ([85.118.1.10]:39255 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756169Ab0GRBtd (ORCPT ); Sat, 17 Jul 2010 21:49:33 -0400 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Frederic Weisbecker , Ingo Molnar , Mike Galbraith , Paul Mackerras , Peter Zijlstra , Stephane Eranian Subject: [PATCH 3/3] perf hists: Factor out duplicated code Date: Sat, 17 Jul 2010 22:48:56 -0300 Message-Id: <1279417736-4396-4-git-send-email-acme@infradead.org> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1279417736-4396-1-git-send-email-acme@infradead.org> References: <1279417736-4396-1-git-send-email-acme@infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2606 Lines: 85 From: Arnaldo Carvalho de Melo Introducing hists__remove_entry_filter. Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian LKML-Reference: Signed-off-by: Arnaldo Carvalho de Melo --- 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 68d288c..7b5848c 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); } } -- 1.6.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/