@@ -216,7 +216,8 @@ static int check_per_pkg(struct perf_evsel *counter, int cpu, bool *skip)
216216}
217217
218218static int
219- process_counter_values (struct perf_evsel * evsel , int cpu , int thread ,
219+ process_counter_values (struct perf_stat_config * config , struct perf_evsel * evsel ,
220+ int cpu , int thread ,
220221 struct perf_counts_values * count )
221222{
222223 struct perf_counts_values * aggr = & evsel -> counts -> aggr ;
@@ -231,20 +232,20 @@ process_counter_values(struct perf_evsel *evsel, int cpu, int thread,
231232 if (skip )
232233 count = & zero ;
233234
234- switch (stat_config . aggr_mode ) {
235+ switch (config -> aggr_mode ) {
235236 case AGGR_THREAD :
236237 case AGGR_CORE :
237238 case AGGR_SOCKET :
238239 case AGGR_NONE :
239240 if (!evsel -> snapshot )
240241 perf_evsel__compute_deltas (evsel , cpu , thread , count );
241- perf_counts_values__scale (count , stat_config . scale , NULL );
242- if (stat_config . aggr_mode == AGGR_NONE )
242+ perf_counts_values__scale (count , config -> scale , NULL );
243+ if (config -> aggr_mode == AGGR_NONE )
243244 perf_stat__update_shadow_stats (evsel , count -> values , cpu );
244245 break ;
245246 case AGGR_GLOBAL :
246247 aggr -> val += count -> val ;
247- if (stat_config . scale ) {
248+ if (config -> scale ) {
248249 aggr -> ena += count -> ena ;
249250 aggr -> run += count -> run ;
250251 }
@@ -255,7 +256,8 @@ process_counter_values(struct perf_evsel *evsel, int cpu, int thread,
255256 return 0 ;
256257}
257258
258- static int process_counter_maps (struct perf_evsel * counter )
259+ static int process_counter_maps (struct perf_stat_config * config ,
260+ struct perf_evsel * counter )
259261{
260262 int nthreads = thread_map__nr (counter -> threads );
261263 int ncpus = perf_evsel__nr_cpus (counter );
@@ -266,7 +268,7 @@ static int process_counter_maps(struct perf_evsel *counter)
266268
267269 for (thread = 0 ; thread < nthreads ; thread ++ ) {
268270 for (cpu = 0 ; cpu < ncpus ; cpu ++ ) {
269- if (process_counter_values (counter , cpu , thread ,
271+ if (process_counter_values (config , counter , cpu , thread ,
270272 perf_counts (counter -> counts , cpu , thread )))
271273 return -1 ;
272274 }
@@ -275,7 +277,8 @@ static int process_counter_maps(struct perf_evsel *counter)
275277 return 0 ;
276278}
277279
278- static int process_counter (struct perf_evsel * counter )
280+ static int process_counter (struct perf_stat_config * config ,
281+ struct perf_evsel * counter )
279282{
280283 struct perf_counts_values * aggr = & counter -> counts -> aggr ;
281284 struct perf_stat * ps = counter -> priv ;
@@ -288,22 +291,22 @@ static int process_counter(struct perf_evsel *counter)
288291 if (counter -> per_pkg )
289292 zero_per_pkg (counter );
290293
291- ret = process_counter_maps (counter );
294+ ret = process_counter_maps (& stat_config , counter );
292295 if (ret )
293296 return ret ;
294297
295- if (stat_config . aggr_mode != AGGR_GLOBAL )
298+ if (config -> aggr_mode != AGGR_GLOBAL )
296299 return 0 ;
297300
298301 if (!counter -> snapshot )
299302 perf_evsel__compute_deltas (counter , -1 , -1 , aggr );
300- perf_counts_values__scale (aggr , stat_config . scale , & counter -> counts -> scaled );
303+ perf_counts_values__scale (aggr , config -> scale , & counter -> counts -> scaled );
301304
302305 for (i = 0 ; i < 3 ; i ++ )
303306 update_stats (& ps -> res_stats [i ], count [i ]);
304307
305308 if (verbose ) {
306- fprintf (stat_config . output , "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n" ,
309+ fprintf (config -> output , "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n" ,
307310 perf_evsel__name (counter ), count [0 ], count [1 ], count [2 ]);
308311 }
309312
@@ -352,7 +355,7 @@ static void read_counters(bool close_counters)
352355 if (read_counter (counter ))
353356 pr_warning ("failed to read counter %s\n" , counter -> name );
354357
355- if (process_counter (counter ))
358+ if (process_counter (& stat_config , counter ))
356359 pr_warning ("failed to process counter %s\n" , counter -> name );
357360
358361 if (close_counters ) {
0 commit comments