@@ -47,6 +47,7 @@ struct sample_statistics {
4747 double q3 ;
4848 double max ;
4949 double mean ;
50+ double ops_per_sec ;
5051};
5152
5253static int parse_args (int argc ,
@@ -429,6 +430,8 @@ int main(int argc, char** argv)
429430 * occurred (if requested), we can locally sort and generate some
430431 * statistics
431432 */
433+ /* calculate ops/s before we possibly truncate sample_index */
434+ stats .ops_per_sec = (double )sample_index / (double )duration_seconds ;
432435 if (sample_index > MAX_SAMPLES ) sample_index = MAX_SAMPLES ;
433436 qsort (samples , sample_index , sizeof (double ), sample_compare );
434437 /* there should be a lot of samples; we aren't going to bother
@@ -445,12 +448,13 @@ int main(int argc, char** argv)
445448 gzprintf (f , "# client_mapping\t<rank>\t<svr_idx>\t<svr_addr_string>\n" );
446449 gzprintf (f , "client_mapping\t%d\t%d\t%s\n" , my_rank , my_rank % nproviders ,
447450 svr_addr_str );
448- gzprintf (
449- f ,
450- "# sample_stats\t<rank>\t<min>\t<q1>\t<median>\t<q3>\t<max>\t<mean>\n" );
451- gzprintf (f , "sample_stats\t%d\t%.9f\t%.9f\t%.9f\t%.9f\t%.9f\t%.9f\n" ,
451+ gzprintf (f ,
452+ "# "
453+ "sample_stats\t<rank>\t<min>\t<q1>\t<median>\t<q3>\t<max>\t<mean>"
454+ "\t<ops/s>\n" );
455+ gzprintf (f , "sample_stats\t%d\t%.9f\t%.9f\t%.9f\t%.9f\t%.9f\t%.9f\t%.3f\n" ,
452456 my_rank , stats .min , stats .q1 , stats .median , stats .q3 , stats .max ,
453- stats .mean );
457+ stats .mean , stats . ops_per_sec );
454458 if (my_rank == 0 ) {
455459 gzprintf (
456460 f , "# server_stats\t<server_rank>\t<utime>\t<stime>\t<alltime>\n" );
0 commit comments