@@ -101,7 +101,6 @@ static struct target target = {
101101
102102static int run_count = 1 ;
103103static bool no_inherit = false;
104- static bool scale = true;
105104static volatile pid_t child_pid = -1 ;
106105static bool null_run = false;
107106static int detailed_run = 0 ;
@@ -127,6 +126,7 @@ static volatile int done = 0;
127126
128127static struct perf_stat_config stat_config = {
129128 .aggr_mode = AGGR_GLOBAL ,
129+ .scale = true,
130130};
131131
132132static inline void diff_timespec (struct timespec * r , struct timespec * a ,
@@ -151,7 +151,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
151151{
152152 struct perf_event_attr * attr = & evsel -> attr ;
153153
154- if (scale )
154+ if (stat_config . scale )
155155 attr -> read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
156156 PERF_FORMAT_TOTAL_TIME_RUNNING ;
157157
@@ -240,13 +240,13 @@ process_counter_values(struct perf_evsel *evsel, int cpu, int thread,
240240 case AGGR_NONE :
241241 if (!evsel -> snapshot )
242242 perf_evsel__compute_deltas (evsel , cpu , thread , count );
243- perf_counts_values__scale (count , scale , NULL );
243+ perf_counts_values__scale (count , stat_config . scale , NULL );
244244 if (stat_config .aggr_mode == AGGR_NONE )
245245 perf_stat__update_shadow_stats (evsel , count -> values , cpu );
246246 break ;
247247 case AGGR_GLOBAL :
248248 aggr -> val += count -> val ;
249- if (scale ) {
249+ if (stat_config . scale ) {
250250 aggr -> ena += count -> ena ;
251251 aggr -> run += count -> run ;
252252 }
@@ -299,7 +299,7 @@ static int process_counter(struct perf_evsel *counter)
299299
300300 if (!counter -> snapshot )
301301 perf_evsel__compute_deltas (counter , -1 , -1 , aggr );
302- perf_counts_values__scale (aggr , scale , & counter -> counts -> scaled );
302+ perf_counts_values__scale (aggr , stat_config . scale , & counter -> counts -> scaled );
303303
304304 for (i = 0 ; i < 3 ; i ++ )
305305 update_stats (& ps -> res_stats [i ], count [i ]);
@@ -1274,7 +1274,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
12741274 "system-wide collection from all CPUs" ),
12751275 OPT_BOOLEAN ('g' , "group" , & group ,
12761276 "put the counters into a counter group" ),
1277- OPT_BOOLEAN ('c' , "scale" , & scale , "scale/normalize counters" ),
1277+ OPT_BOOLEAN ('c' , "scale" , & stat_config . scale , "scale/normalize counters" ),
12781278 OPT_INCR ('v' , "verbose" , & verbose ,
12791279 "be more verbose (show counter open errors, etc)" ),
12801280 OPT_INTEGER ('r' , "repeat" , & run_count ,
0 commit comments