@@ -113,7 +113,6 @@ static bool group = false;
113113static const char * pre_cmd = NULL ;
114114static const char * post_cmd = NULL ;
115115static bool sync_run = false;
116- static unsigned int interval = 0 ;
117116static unsigned int initial_delay = 0 ;
118117static unsigned int unit_width = 4 ; /* strlen("unit") */
119118static bool forever = false;
@@ -404,6 +403,7 @@ static void workload_exec_failed_signal(int signo __maybe_unused, siginfo_t *inf
404403
405404static int __run_perf_stat (int argc , const char * * argv )
406405{
406+ int interval = stat_config .interval ;
407407 char msg [512 ];
408408 unsigned long long t0 , t1 ;
409409 struct perf_evsel * counter ;
@@ -646,7 +646,7 @@ static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)
646646 if (evsel -> cgrp )
647647 fprintf (output , "%s%s" , csv_sep , evsel -> cgrp -> name );
648648
649- if (csv_output || interval )
649+ if (csv_output || stat_config . interval )
650650 return ;
651651
652652 if (perf_evsel__match (evsel , SOFTWARE , SW_TASK_CLOCK ))
@@ -689,7 +689,7 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
689689 if (evsel -> cgrp )
690690 fprintf (output , "%s%s" , csv_sep , evsel -> cgrp -> name );
691691
692- if (csv_output || interval )
692+ if (csv_output || stat_config . interval )
693693 return ;
694694
695695 perf_stat__print_shadow_stats (output , evsel , avg , cpu ,
@@ -990,6 +990,7 @@ static void print_footer(void)
990990
991991static void print_counters (struct timespec * ts , int argc , const char * * argv )
992992{
993+ int interval = stat_config .interval ;
993994 struct perf_evsel * counter ;
994995 char buf [64 ], * prefix = NULL ;
995996
@@ -1029,7 +1030,7 @@ static volatile int signr = -1;
10291030
10301031static void skip_signal (int signo )
10311032{
1032- if ((child_pid == -1 ) || interval )
1033+ if ((child_pid == -1 ) || stat_config . interval )
10331034 done = 1 ;
10341035
10351036 signr = signo ;
@@ -1313,7 +1314,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
13131314 "command to run prior to the measured command" ),
13141315 OPT_STRING (0 , "post" , & post_cmd , "command" ,
13151316 "command to run after to the measured command" ),
1316- OPT_UINTEGER ('I' , "interval-print" , & interval ,
1317+ OPT_UINTEGER ('I' , "interval-print" , & stat_config . interval ,
13171318 "print counts at regular interval in ms (>= 100)" ),
13181319 OPT_SET_UINT (0 , "per-socket" , & stat_config .aggr_mode ,
13191320 "aggregate counts per processor socket" , AGGR_SOCKET ),
@@ -1332,6 +1333,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
13321333 int status = - EINVAL , run_idx ;
13331334 const char * mode ;
13341335 FILE * output = stderr ;
1336+ unsigned int interval ;
13351337
13361338 setlocale (LC_ALL , "" );
13371339
@@ -1342,6 +1344,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
13421344 argc = parse_options (argc , argv , options , stat_usage ,
13431345 PARSE_OPT_STOP_AT_NON_OPTION );
13441346
1347+ interval = stat_config .interval ;
1348+
13451349 if (output_name && strcmp (output_name , "-" ))
13461350 output = NULL ;
13471351
0 commit comments