@@ -713,6 +713,13 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
713
713
(*i)->start ();
714
714
}
715
715
716
+ unsigned long int prev_ops = 0 ;
717
+ unsigned long int prev_bytes = 0 ;
718
+ unsigned long int prev_duration = 0 ;
719
+ double prev_latency = 0 , cur_latency = 0 ;
720
+ unsigned long int cur_ops_sec = 0 ;
721
+ unsigned long int cur_bytes_sec = 0 ;
722
+
716
723
// provide some feedback...
717
724
unsigned int active_threads = 0 ;
718
725
do {
@@ -731,10 +738,19 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
731
738
total_ops += (*i)->m_cg ->get_total_ops ();
732
739
total_bytes += (*i)->m_cg ->get_total_bytes ();
733
740
total_latency += (*i)->m_cg ->get_total_latency ();
734
- if ((*i)->m_cg ->get_duration_usec () > duration)
741
+ if ((*i)->m_cg ->get_duration_usec () > duration)
735
742
duration = (*i)->m_cg ->get_duration_usec ();
736
743
}
737
744
745
+ unsigned long int cur_ops = total_ops-prev_ops;
746
+ unsigned long int cur_bytes = total_bytes-prev_bytes;
747
+ unsigned long int cur_duration = duration-prev_duration;
748
+ double cur_total_latency = total_latency-prev_latency;
749
+ prev_ops = total_ops;
750
+ prev_bytes = total_bytes;
751
+ prev_latency = total_latency;
752
+ prev_duration = duration;
753
+
738
754
unsigned long int ops_sec = 0 ;
739
755
unsigned long int bytes_sec = 0 ;
740
756
double avg_latency = 0 ;
@@ -743,12 +759,24 @@ run_stats run_benchmark(int run_id, benchmark_config* cfg, object_generator* obj
743
759
bytes_sec = (long )( (double )total_bytes / duration * 1000000 );
744
760
avg_latency = ((double ) total_latency / 1000 / total_ops) ;
745
761
}
762
+ if (cur_duration > 1000000 && active_threads == cfg->threads ) {
763
+ cur_ops_sec = (long )( (double )cur_ops / cur_duration * 1000000 );
764
+ cur_bytes_sec = (long )( (double )cur_bytes / cur_duration * 1000000 );
765
+ cur_latency = ((double ) cur_total_latency / 1000 / cur_ops) ;
766
+ }
746
767
747
- char bytes_str[40 ];
768
+ char bytes_str[40 ], cur_bytes_str[ 40 ] ;
748
769
size_to_str (bytes_sec, bytes_str, sizeof (bytes_str)-1 );
770
+ size_to_str (cur_bytes_sec, cur_bytes_str, sizeof (cur_bytes_str)-1 );
771
+
772
+ double progress = 0 ;
773
+ if (cfg->requests )
774
+ progress = 100.0 * total_ops / (cfg->requests *cfg->clients *cfg->threads );
775
+ else
776
+ progress = 100.0 * (duration / 1000000.0 )/cfg->test_time ;
749
777
750
- fprintf (stderr, " [RUN #%u, %3u secs] %2u threads: %11lu ops, %7lu ops/sec, %s/sec, %5.2fmsec latency\r " ,
751
- run_id, (unsigned int ) (duration / 1000000 ), active_threads, total_ops, ops_sec, bytes_str, avg_latency);
778
+ fprintf (stderr, " [RUN #%u %.0f%% , %3u secs] %2u threads: %11lu ops, %7lu (avg: %7lu) ops/sec, %s/sec (avg: %s/sec) , %5.2f (avg: %5.2f) msec latency\r " ,
779
+ run_id, progress, (unsigned int ) (duration / 1000000 ), active_threads, total_ops, cur_ops_sec, ops_sec, cur_bytes_str, bytes_str, cur_latency , avg_latency);
752
780
} while (active_threads > 0 );
753
781
754
782
fprintf (stderr, " \n\n " );
0 commit comments