@@ -390,6 +390,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
390390    static  struct  option  long_options[] = {
391391        { " server"  ,                     1 , 0 , ' s'   },
392392        { " port"  ,                       1 , 0 , ' p'   },
393+         { " print-frequency"  ,            1 , 0 , ' f'   },
393394        { " unix-socket"  ,                1 , 0 , ' S'   },
394395        { " protocol"  ,                   1 , 0 , ' P'   },
395396#ifdef  USE_TLS
@@ -453,7 +454,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
453454    int  c;
454455    char  *endptr;
455456    while  ((c = getopt_long (argc, argv,
456-                 " s:S:p:P:o:x:DRn:c:t:d:a:h"  , long_options, &option_index)) != -1 )
457+                 " s:S:p:P:f: o:x:DRn:c:t:d:a:h"  , long_options, &option_index)) != -1 )
457458    {
458459        switch  (c) {
459460                case  ' h'  :
@@ -481,6 +482,14 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
481482                        return  -1 ;
482483                    }
483484                    break ;
485+                 case  ' f'  :
486+                     endptr = NULL ;
487+                     cfg->print_frequency_every_seconds  = (int ) strtoul (optarg, &endptr, 10 );
488+                     if  (cfg->print_frequency_every_seconds  < 0  || !endptr || *endptr != ' \0 '  ) {
489+                         fprintf (stderr, " error: print_frequency_every_seconds must be greater than zero.\n "  );
490+                         return  -1 ;
491+                     }
492+                     break ;
484493                case  ' P'  :
485494                    if  (strcmp (optarg, " memcache_text"  ) &&
486495                        strcmp (optarg, " memcache_binary"  ) &&
@@ -845,6 +854,7 @@ void usage() {
845854            "                                  and Redis <= 5.x. <USER>:<PASSWORD> can be\n " 
846855            "                                  specified for memcache_binary or Redis 6.x\n " 
847856            "                                  or newer with ACL user support.\n " 
857+             "   -f, --print-frequency print frequncy (default: 1)\n " 
848858#ifdef  USE_TLS
849859            "       --tls                      Enable SSL/TLS transport security\n " 
850860            "       --cert=FILE                Use specified client certificate for TLS\n " 
@@ -1047,7 +1057,11 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
10471057    unsigned  int  active_threads = 0 ;
10481058    do  {
10491059        active_threads = 0 ;
1050-         sleep (1 );
1060+         if  (cfg->print_frequency_every_seconds ) {
1061+             sleep (cfg->print_frequency_every_seconds );
1062+         } else  {
1063+             sleep (1 );
1064+         }
10511065
10521066        unsigned  long  int  total_ops = 0 ;
10531067        unsigned  long  int  total_bytes = 0 ;
0 commit comments