summaryrefslogtreecommitdiff
path: root/tools/perf/util/stat.c
diff options
context:
space:
mode:
authorJin Yao <yao.jin@linux.intel.com>2020-05-20 07:27:34 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-05-28 16:03:27 +0300
commitcf4d9bd67cb1531a775599d04b9258c5e16b3fc6 (patch)
treef5721f45ef0480b64485cf1a60d4e0c69c03b394 /tools/perf/util/stat.c
parent72f02a947e89223b1b4a7825b68b2ba8fd2852c8 (diff)
downloadlinux-cf4d9bd67cb1531a775599d04b9258c5e16b3fc6.tar.xz
perf counts: Reset prev_raw_counts counts
When we want to reset the evsel->prev_raw_counts, zeroing the aggr is not enough, we need to reset the perf_counts too. The perf_counts__reset zeros the perf_counts, and it should zero the aggr too. This patch changes perf_counts__reset to non-static, and calls it in evsel__reset_prev_raw_counts to reset the prev_raw_counts. Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jin Yao <yao.jin@intel.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20200520042737.24160-3-yao.jin@linux.intel.com 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.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index f4a44df9b221..e397815f0dfb 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -163,11 +163,8 @@ static void evsel__free_prev_raw_counts(struct evsel *evsel)
static void evsel__reset_prev_raw_counts(struct evsel *evsel)
{
- if (evsel->prev_raw_counts) {
- evsel->prev_raw_counts->aggr.val = 0;
- evsel->prev_raw_counts->aggr.ena = 0;
- evsel->prev_raw_counts->aggr.run = 0;
- }
+ if (evsel->prev_raw_counts)
+ perf_counts__reset(evsel->prev_raw_counts);
}
static int evsel__alloc_stats(struct evsel *evsel, bool alloc_raw)