From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755939AbbFOUQg (ORCPT ); Mon, 15 Jun 2015 16:16:36 -0400 Received: from mail.kernel.org ([198.145.29.136]:54856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752599AbbFOUQL (ORCPT ); Mon, 15 Jun 2015 16:16:11 -0400 Date: Mon, 15 Jun 2015 17:13:45 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: lkml , Adrian Hunter , Andi Kleen , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra , Stephane Eranian Subject: Re: [PATCH 11/30] perf tools: Move perf_evsel__(alloc|free|reset)_counts into stat object Message-ID: <20150615201345.GH5845@kernel.org> References: <1434269985-521-1-git-send-email-jolsa@kernel.org> <1434269985-521-12-git-send-email-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434269985-521-12-git-send-email-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sun, Jun 14, 2015 at 10:19:26AM +0200, Jiri Olsa escreveu: > It's stat specific. Updating python build objects with stat.c. > > Link: http://lkml.kernel.org/n/tip-36bz60viixc7bd5vh8oywazc@git.kernel.org > Signed-off-by: Jiri Olsa thanks, applied. - Arnaldo > --- > tools/perf/tests/openat-syscall-all-cpus.c | 1 + > tools/perf/util/evsel.c | 19 +------------------ > tools/perf/util/evsel.h | 3 --- > tools/perf/util/python-ext-sources | 1 + > tools/perf/util/stat.c | 18 ++++++++++++++++++ > tools/perf/util/stat.h | 3 +++ > 6 files changed, 24 insertions(+), 21 deletions(-) > > diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c > index 8801983a38f0..b8d552b13950 100644 > --- a/tools/perf/tests/openat-syscall-all-cpus.c > +++ b/tools/perf/tests/openat-syscall-all-cpus.c > @@ -3,6 +3,7 @@ > #include "thread_map.h" > #include "cpumap.h" > #include "debug.h" > +#include "stat.h" > > int test__openat_syscall_event_on_all_cpus(void) > { > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index 6ef818475aa3..1b2f480a3e82 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -26,6 +26,7 @@ > #include "perf_regs.h" > #include "debug.h" > #include "trace-event.h" > +#include "stat.h" > > static struct { > bool sample_id_all; > @@ -851,19 +852,6 @@ int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads) > return 0; > } > > -void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus) > -{ > - memset(evsel->counts, 0, (sizeof(*evsel->counts) + > - (ncpus * sizeof(struct perf_counts_values)))); > -} > - > -int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus) > -{ > - evsel->counts = zalloc((sizeof(*evsel->counts) + > - (ncpus * sizeof(struct perf_counts_values)))); > - return evsel->counts != NULL ? 0 : -ENOMEM; > -} > - > static void perf_evsel__free_fd(struct perf_evsel *evsel) > { > xyarray__delete(evsel->fd); > @@ -891,11 +879,6 @@ void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads) > } > } > > -void perf_evsel__free_counts(struct perf_evsel *evsel) > -{ > - zfree(&evsel->counts); > -} > - > void perf_evsel__exit(struct perf_evsel *evsel) > { > assert(list_empty(&evsel->node)); > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > index 54afdc80a651..4dbf32d94dfb 100644 > --- a/tools/perf/util/evsel.h > +++ b/tools/perf/util/evsel.h > @@ -182,9 +182,6 @@ const char *perf_evsel__group_name(struct perf_evsel *evsel); > int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size); > > int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads); > -int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus); > -void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus); > -void perf_evsel__free_counts(struct perf_evsel *evsel); > void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads); > > void __perf_evsel__set_sample_bit(struct perf_evsel *evsel, > diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources > index 55ba8968a263..572d39ab7bdf 100644 > --- a/tools/perf/util/python-ext-sources > +++ b/tools/perf/util/python-ext-sources > @@ -20,3 +20,4 @@ util/strlist.c > util/trace-event.c > ../../lib/rbtree.c > util/string.c > +util/stat.c > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c > index 60b92822f655..ac589b6b8bce 100644 > --- a/tools/perf/util/stat.c > +++ b/tools/perf/util/stat.c > @@ -94,3 +94,21 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel) > } > } > } > + > +void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus) > +{ > + memset(evsel->counts, 0, (sizeof(*evsel->counts) + > + (ncpus * sizeof(struct perf_counts_values)))); > +} > + > +int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus) > +{ > + evsel->counts = zalloc((sizeof(*evsel->counts) + > + (ncpus * sizeof(struct perf_counts_values)))); > + return evsel->counts != NULL ? 0 : -ENOMEM; > +} > + > +void perf_evsel__free_counts(struct perf_evsel *evsel) > +{ > + zfree(&evsel->counts); > +} > diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h > index 615c779eb42a..6a782601c1c7 100644 > --- a/tools/perf/util/stat.h > +++ b/tools/perf/util/stat.h > @@ -62,4 +62,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count, > void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel, > double avg, int cpu, enum aggr_mode aggr); > > +void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus); > +int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus); > +void perf_evsel__free_counts(struct perf_evsel *evsel); > #endif > -- > 1.9.3