aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/stat.c')
-rw-r--r--tools/perf/util/stat.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2f901d15e063..4d9b481cf3b6 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -97,7 +97,7 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel)
97 } 97 }
98} 98}
99 99
100void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) 100static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
101{ 101{
102 int i; 102 int i;
103 struct perf_stat_evsel *ps = evsel->priv; 103 struct perf_stat_evsel *ps = evsel->priv;
@@ -108,7 +108,7 @@ void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
108 perf_stat_evsel_id_init(evsel); 108 perf_stat_evsel_id_init(evsel);
109} 109}
110 110
111int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) 111static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
112{ 112{
113 evsel->priv = zalloc(sizeof(struct perf_stat_evsel)); 113 evsel->priv = zalloc(sizeof(struct perf_stat_evsel));
114 if (evsel->priv == NULL) 114 if (evsel->priv == NULL)
@@ -117,13 +117,13 @@ int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
117 return 0; 117 return 0;
118} 118}
119 119
120void perf_evsel__free_stat_priv(struct perf_evsel *evsel) 120static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
121{ 121{
122 zfree(&evsel->priv); 122 zfree(&evsel->priv);
123} 123}
124 124
125int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel, 125static int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
126 int ncpus, int nthreads) 126 int ncpus, int nthreads)
127{ 127{
128 struct perf_counts *counts; 128 struct perf_counts *counts;
129 129
@@ -134,13 +134,13 @@ int perf_evsel__alloc_prev_raw_counts(struct perf_evsel *evsel,
134 return counts ? 0 : -ENOMEM; 134 return counts ? 0 : -ENOMEM;
135} 135}
136 136
137void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) 137static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel)
138{ 138{
139 perf_counts__delete(evsel->prev_raw_counts); 139 perf_counts__delete(evsel->prev_raw_counts);
140 evsel->prev_raw_counts = NULL; 140 evsel->prev_raw_counts = NULL;
141} 141}
142 142
143int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw) 143static int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw)
144{ 144{
145 int ncpus = perf_evsel__nr_cpus(evsel); 145 int ncpus = perf_evsel__nr_cpus(evsel);
146 int nthreads = thread_map__nr(evsel->threads); 146 int nthreads = thread_map__nr(evsel->threads);
@@ -310,7 +310,16 @@ int perf_stat_process_counter(struct perf_stat_config *config,
310 int i, ret; 310 int i, ret;
311 311
312 aggr->val = aggr->ena = aggr->run = 0; 312 aggr->val = aggr->ena = aggr->run = 0;
313 init_stats(ps->res_stats); 313
314 /*
315 * We calculate counter's data every interval,
316 * and the display code shows ps->res_stats
317 * avg value. We need to zero the stats for
318 * interval mode, otherwise overall avg running
319 * averages will be shown for each interval.
320 */
321 if (config->interval)
322 init_stats(ps->res_stats);
314 323
315 if (counter->per_pkg) 324 if (counter->per_pkg)
316 zero_per_pkg(counter); 325 zero_per_pkg(counter);