@@ -390,6 +390,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
390
390
static struct option long_options[] = {
391
391
{ " server" , 1 , 0 , ' s' },
392
392
{ " port" , 1 , 0 , ' p' },
393
+ { " print-frequency" , 1 , 0 , ' f' },
393
394
{ " unix-socket" , 1 , 0 , ' S' },
394
395
{ " protocol" , 1 , 0 , ' P' },
395
396
#ifdef USE_TLS
@@ -453,7 +454,7 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
453
454
int c;
454
455
char *endptr;
455
456
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 )
457
458
{
458
459
switch (c) {
459
460
case ' h' :
@@ -481,6 +482,14 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
481
482
return -1 ;
482
483
}
483
484
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 ;
484
493
case ' P' :
485
494
if (strcmp (optarg , " memcache_text" ) &&
486
495
strcmp (optarg , " memcache_binary" ) &&
@@ -845,6 +854,7 @@ void usage() {
845
854
" and Redis <= 5.x. <USER>:<PASSWORD> can be\n "
846
855
" specified for memcache_binary or Redis 6.x\n "
847
856
" or newer with ACL user support.\n "
857
+ " -f, --print-frequency print frequncy (default: 1)\n "
848
858
#ifdef USE_TLS
849
859
" --tls Enable SSL/TLS transport security\n "
850
860
" --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
1047
1057
unsigned int active_threads = 0 ;
1048
1058
do {
1049
1059
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
+ }
1051
1065
1052
1066
unsigned long int total_ops = 0 ;
1053
1067
unsigned long int total_bytes = 0 ;
0 commit comments