Commit 8f97963e authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf stat: Reset aggr counts for each interval

The evsel->stats->aggr->count should be reset for interval processing
since we want to use the values directly for display.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221018020227.85905-14-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent ae7e6492
......@@ -492,6 +492,8 @@ static void process_interval(void)
diff_timespec(&rs, &ts, &ref_time);
perf_stat__reset_shadow_per_stat(&rt_stat);
evlist__reset_aggr_stats(evsel_list);
read_counters(&rs);
if (STAT_RECORD) {
......@@ -965,6 +967,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
evlist__copy_prev_raw_counts(evsel_list);
evlist__reset_prev_raw_counts(evsel_list);
evlist__reset_aggr_stats(evsel_list);
perf_stat__reset_shadow_per_stat(&rt_stat);
} else {
update_stats(&walltime_nsecs_stats, t1 - t0);
......
......@@ -130,17 +130,23 @@ static void perf_stat_evsel_id_init(struct evsel *evsel)
}
}
static void evsel__reset_stat_priv(struct evsel *evsel)
static void evsel__reset_aggr_stats(struct evsel *evsel)
{
struct perf_stat_evsel *ps = evsel->stats;
struct perf_stat_aggr *aggr = ps->aggr;
init_stats(&ps->res_stats);
if (aggr)
memset(aggr, 0, sizeof(*aggr) * ps->nr_aggr);
}
static void evsel__reset_stat_priv(struct evsel *evsel)
{
struct perf_stat_evsel *ps = evsel->stats;
init_stats(&ps->res_stats);
evsel__reset_aggr_stats(evsel);
}
static int evsel__alloc_aggr_stats(struct evsel *evsel, int nr_aggr)
{
struct perf_stat_evsel *ps = evsel->stats;
......@@ -276,6 +282,14 @@ void evlist__reset_stats(struct evlist *evlist)
}
}
void evlist__reset_aggr_stats(struct evlist *evlist)
{
struct evsel *evsel;
evlist__for_each_entry(evlist, evsel)
evsel__reset_aggr_stats(evsel);
}
void evlist__reset_prev_raw_counts(struct evlist *evlist)
{
struct evsel *evsel;
......
......@@ -276,6 +276,7 @@ void evlist__copy_prev_raw_counts(struct evlist *evlist);
void evlist__save_aggr_prev_raw_counts(struct evlist *evlist);
int evlist__alloc_aggr_stats(struct evlist *evlist, int nr_aggr);
void evlist__reset_aggr_stats(struct evlist *evlist);
int perf_stat_process_counter(struct perf_stat_config *config,
struct evsel *counter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment