diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-06-26 11:29:14 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-26 11:26:44 -0300 |
commit | 9689edfabc1547155a7cdd1304fd294107054291 (patch) | |
tree | f20457901f70fe97eeef0550c790be67818955dd /tools/perf/util/stat.c | |
parent | 254ecbc7474dfa08155c5595e90cd4a0fa9d14ce (diff) | |
download | op-kernel-dev-9689edfabc1547155a7cdd1304fd294107054291.zip op-kernel-dev-9689edfabc1547155a7cdd1304fd294107054291.tar.gz |
perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object
Moving perf_evsel__(alloc|free|reset)_stat_priv into stat object, so it
could be used outside stat command in following patches.
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/1435310967-14570-10-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 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 197a2db..b8c329f 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -143,3 +143,28 @@ void perf_evsel__free_counts(struct perf_evsel *evsel) perf_counts__delete(evsel->counts); evsel->counts = NULL; } + +void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) +{ + int i; + struct perf_stat *ps = evsel->priv; + + for (i = 0; i < 3; i++) + init_stats(&ps->res_stats[i]); + + perf_stat_evsel_id_init(evsel); +} + +int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) +{ + evsel->priv = zalloc(sizeof(struct perf_stat)); + if (evsel->priv == NULL) + return -ENOMEM; + perf_evsel__reset_stat_priv(evsel); + return 0; +} + +void perf_evsel__free_stat_priv(struct perf_evsel *evsel) +{ + zfree(&evsel->priv); +} |