diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-06-14 10:19:26 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-16 10:34:40 -0300 |
commit | a9a3a4d92d8f2fb68f4b99d98505bebc70518599 (patch) | |
tree | 14ddaed0169411ea3dc99a8f3e7b1f07793e9ec3 /tools/perf/util/stat.c | |
parent | 9d7e8c3a96e5a903a4e0951e08f7fa6957170bef (diff) | |
download | linux-a9a3a4d92d8f2fb68f4b99d98505bebc70518599.tar.bz2 |
perf tools: Move perf_evsel__(alloc|free|reset)_counts into stat object
It's stat specific. Updating python build objects with stat.c.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1434269985-521-12-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat.c')
-rw-r--r-- | tools/perf/util/stat.c | 18 |
1 files changed, 18 insertions, 0 deletions
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); +} |