summaryrefslogtreecommitdiffstats
path: root/kernel/tools/perf/util/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/tools/perf/util/stat.c')
-rw-r--r--kernel/tools/perf/util/stat.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/tools/perf/util/stat.c b/kernel/tools/perf/util/stat.c
index 4a3a72cb5..6ce624cb7 100644
--- a/kernel/tools/perf/util/stat.c
+++ b/kernel/tools/perf/util/stat.c
@@ -311,6 +311,16 @@ int perf_stat_process_counter(struct perf_stat_config *config,
aggr->val = aggr->ena = aggr->run = 0;
+ /*
+ * We calculate counter's data every interval,
+ * and the display code shows ps->res_stats
+ * avg value. We need to zero the stats for
+ * interval mode, otherwise overall avg running
+ * averages will be shown for each interval.
+ */
+ if (config->interval)
+ init_stats(ps->res_stats);
+
if (counter->per_pkg)
zero_per_pkg(counter);