@@ -26,6 +26,50 @@ It follows the hierarchical file system semantics in contrast to the md-workbenc
26
26
27
27
#define oprintf (...) do { fprintf(o.logfile, __VA_ARGS__); fflush(o.logfile); } while(0);
28
28
29
+ // successfull, errors
30
+ typedef struct {
31
+ int suc ;
32
+ int err ;
33
+ } op_stat_t ;
34
+
35
+ // A runtime for an operation and when the operation was started
36
+ typedef struct {
37
+ float time_since_app_start ;
38
+ float runtime ;
39
+ } time_result_t ;
40
+
41
+
42
+ // statistics for running a single phase
43
+ typedef struct { // NOTE: if this type is changed, adjust end_phase() !!!
44
+ double t ; // maximum time
45
+ double * t_all ;
46
+
47
+ op_stat_t dset_create ;
48
+ op_stat_t dset_delete ;
49
+
50
+ op_stat_t obj_create ;
51
+ op_stat_t obj_read ;
52
+ op_stat_t obj_stat ;
53
+ op_stat_t obj_delete ;
54
+
55
+ // time measurements of individual runs, these are not returned for now by the API!
56
+ uint64_t repeats ;
57
+ time_result_t * time_create ;
58
+ time_result_t * time_read ;
59
+ time_result_t * time_stat ;
60
+ time_result_t * time_delete ;
61
+
62
+ time_statistics_t stats_create ;
63
+ time_statistics_t stats_read ;
64
+ time_statistics_t stats_stat ;
65
+ time_statistics_t stats_delete ;
66
+
67
+ // the maximum time for any single operation
68
+ double max_op_time ;
69
+ double phase_start_timer ;
70
+ int stonewall_iterations ;
71
+ } phase_stat_t ;
72
+
29
73
struct benchmark_options {
30
74
ior_aiori_t const * backend ;
31
75
void * backend_options ;
@@ -38,7 +82,7 @@ struct benchmark_options{
38
82
int precreate ;
39
83
int dset_count ;
40
84
41
- int result_position ; // in the global structure
85
+ mdworkbench_results_t * results ; // the results
42
86
43
87
int offset ;
44
88
int iterations ;
@@ -211,10 +255,13 @@ static void print_p_stat(char * buff, const char * name, phase_stat_t * p, doubl
211
255
ioops_per_iter = 2 ;
212
256
}
213
257
258
+ double rate ;
259
+
214
260
switch (name [0 ]){
215
261
case ('b' ):
262
+ rate = p -> obj_read .suc * ioops_per_iter / t ;
216
263
pos += sprintf (buff + pos , "rate:%.1f iops/s objects:%d rate:%.1f obj/s tp:%.1f MiB/s op-max:%.4es" ,
217
- p -> obj_read . suc * ioops_per_iter / t , // write, stat, read, delete
264
+ rate , // write, stat, read, delete
218
265
p -> obj_read .suc ,
219
266
p -> obj_read .suc / t ,
220
267
tp ,
@@ -225,8 +272,9 @@ static void print_p_stat(char * buff, const char * name, phase_stat_t * p, doubl
225
272
}
226
273
break ;
227
274
case ('p' ):
275
+ rate = (p -> dset_create .suc + p -> obj_create .suc ) / t ;
228
276
pos += sprintf (buff + pos , "rate:%.1f iops/s dsets: %d objects:%d rate:%.3f dset/s rate:%.1f obj/s tp:%.1f MiB/s op-max:%.4es" ,
229
- ( p -> dset_create . suc + p -> obj_create . suc ) / t ,
277
+ rate ,
230
278
p -> dset_create .suc ,
231
279
p -> obj_create .suc ,
232
280
p -> dset_create .suc / t ,
@@ -235,8 +283,9 @@ static void print_p_stat(char * buff, const char * name, phase_stat_t * p, doubl
235
283
p -> max_op_time );
236
284
break ;
237
285
case ('c' ):
286
+ rate = (p -> obj_delete .suc + p -> dset_delete .suc ) / t ;
238
287
pos += sprintf (buff + pos , "rate:%.1f iops/s objects:%d dsets: %d rate:%.1f obj/s rate:%.3f dset/s op-max:%.4es" ,
239
- ( p -> obj_delete . suc + p -> dset_delete . suc ) / t ,
288
+ rate ,
240
289
p -> obj_delete .suc ,
241
290
p -> dset_delete .suc ,
242
291
p -> obj_delete .suc / t ,
@@ -248,6 +297,16 @@ static void print_p_stat(char * buff, const char * name, phase_stat_t * p, doubl
248
297
break ;
249
298
}
250
299
300
+ if (print_global ){
301
+ mdworkbench_result_t * res = & o .results -> result [o .results -> count ];
302
+ res -> errors = errs ;
303
+ o .results -> errors += errs ;
304
+ res -> rate = rate ;
305
+ res -> max_op_time = p -> max_op_time ;
306
+ res -> runtime = t ;
307
+ res -> iterations_done = p -> repeats ;
308
+ }
309
+
251
310
if (! o .quiet_output || errs > 0 ){
252
311
pos += sprintf (buff + pos , " (%d errs" , errs );
253
312
if (errs > 0 ){
@@ -341,7 +400,7 @@ static void compute_histogram(const char * name, time_result_t * times, time_sta
341
400
stats -> max = times [repeats - 1 ].runtime ;
342
401
}
343
402
344
- static void end_phase (const char * name , phase_stat_t * p , phase_stat_t * result ){
403
+ static void end_phase (const char * name , phase_stat_t * p ){
345
404
int ret ;
346
405
char buff [MAX_PATHLEN ];
347
406
@@ -452,8 +511,13 @@ static void end_phase(const char * name, phase_stat_t * p, phase_stat_t * result
452
511
}
453
512
454
513
// copy the result back for the API
455
- memcpy (& result [o .result_position ], & g_stat , sizeof (g_stat ));
456
- o .result_position ++ ;
514
+ mdworkbench_result_t * res = & o .results -> result [o .results -> count ];
515
+ memcpy (& res -> stats_create , & g_stat .stats_create , sizeof (time_statistics_t ));
516
+ memcpy (& res -> stats_read , & g_stat .stats_read , sizeof (time_statistics_t ));
517
+ memcpy (& res -> stats_stat , & g_stat .stats_stat , sizeof (time_statistics_t ));
518
+ memcpy (& res -> stats_delete , & g_stat .stats_delete , sizeof (time_statistics_t ));
519
+
520
+ o .results -> count ++ ;
457
521
458
522
// allocate memory if necessary
459
523
// ret = mem_preallocate(& limit_memory_P, o.limit_memory_between_phases, o.verbosity >= 3);
@@ -783,7 +847,7 @@ static void store_position(int position){
783
847
fclose (f );
784
848
}
785
849
786
- phase_stat_t * md_workbench_run (int argc , char * * argv , MPI_Comm world_com , FILE * out_logfile ){
850
+ mdworkbench_results_t * md_workbench_run (int argc , char * * argv , MPI_Comm world_com , FILE * out_logfile ){
787
851
int ret ;
788
852
int printhelp = 0 ;
789
853
char * limit_memory_P = NULL ;
@@ -873,7 +937,10 @@ phase_stat_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_com, FILE
873
937
double bench_start ;
874
938
bench_start = GetTimeStamp ();
875
939
phase_stat_t phase_stats ;
876
- phase_stat_t * all_phases_stats = malloc (sizeof (phase_stat_t ) * (2 + o .iterations ));
940
+ size_t result_count = (2 + o .iterations ) * (o .adaptive_waiting_mode ? 7 : 1 );
941
+ o .results = malloc (sizeof (mdworkbench_results_t ) + sizeof (mdworkbench_result_t ) * result_count );
942
+ memset (o .results , 0 , sizeof (mdworkbench_results_t ) + sizeof (mdworkbench_result_t ) * result_count );
943
+ o .results -> count = 0 ;
877
944
878
945
if (o .rank == 0 && o .print_detailed_stats && ! o .quiet_output ){
879
946
print_detailed_stat_header ();
@@ -892,7 +959,7 @@ phase_stat_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_com, FILE
892
959
phase_stats .phase_start_timer = GetTimeStamp ();
893
960
run_precreate (& phase_stats , current_index );
894
961
phase_stats .t = GetTimeStamp () - phase_stats .phase_start_timer ;
895
- end_phase ("precreate" , & phase_stats , all_phases_stats );
962
+ end_phase ("precreate" , & phase_stats );
896
963
}
897
964
898
965
if (o .phase_benchmark ){
@@ -905,7 +972,7 @@ phase_stat_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_com, FILE
905
972
MPI_Barrier (o .com );
906
973
phase_stats .phase_start_timer = GetTimeStamp ();
907
974
run_benchmark (& phase_stats , & current_index );
908
- end_phase ("benchmark" , & phase_stats , all_phases_stats );
975
+ end_phase ("benchmark" , & phase_stats );
909
976
910
977
if (o .adaptive_waiting_mode ){
911
978
o .relative_waiting_factor = 0.0625 ;
@@ -914,7 +981,7 @@ phase_stat_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_com, FILE
914
981
MPI_Barrier (o .com );
915
982
phase_stats .phase_start_timer = GetTimeStamp ();
916
983
run_benchmark (& phase_stats , & current_index );
917
- end_phase ("benchmark" , & phase_stats , all_phases_stats );
984
+ end_phase ("benchmark" , & phase_stats );
918
985
o .relative_waiting_factor *= 2 ;
919
986
}
920
987
}
@@ -927,7 +994,7 @@ phase_stat_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_com, FILE
927
994
phase_stats .phase_start_timer = GetTimeStamp ();
928
995
run_cleanup (& phase_stats , current_index );
929
996
phase_stats .t = GetTimeStamp () - phase_stats .phase_start_timer ;
930
- end_phase ("cleanup" , & phase_stats , all_phases_stats );
997
+ end_phase ("cleanup" , & phase_stats );
931
998
932
999
if (o .rank == 0 ){
933
1000
if (o .backend -> rmdir (o .prefix , o .backend_options ) != 0 ) {
@@ -947,5 +1014,5 @@ phase_stat_t* md_workbench_run(int argc, char ** argv, MPI_Comm world_com, FILE
947
1014
printTime ();
948
1015
}
949
1016
//mem_free_preallocated(& limit_memory_P);
950
- return all_phases_stats ;
1017
+ return o . results ;
951
1018
}
0 commit comments