30
30
31
31
#define WRITE_SIZE (8 * 1024) /* 8k */
32
32
33
- #define LABEL_FORMAT "\t%-30s"
33
+ #define LABEL_FORMAT " %-32s"
34
+ #define NA_FORMAT LABEL_FORMAT "%18s"
34
35
35
36
36
37
int loops = 2000 ;
@@ -129,7 +130,7 @@ main(int argc, char *argv[])
129
130
#if PG_O_DIRECT != 0
130
131
fflush (stdout );
131
132
if ((tmpfile = open (filename , O_RDWR | O_DSYNC | PG_O_DIRECT , 0 )) == -1 )
132
- printf ("\t(unavailable: o_direct on this filesystem) \n" );
133
+ printf (NA_FORMAT , " o_direct" , "n/a on this filesystem\n" );
133
134
else
134
135
{
135
136
printf (LABEL_FORMAT , "open_datasync 8k direct I/O write" );
@@ -146,11 +147,11 @@ main(int argc, char *argv[])
146
147
print_elapse (start_t , stop_t );
147
148
}
148
149
#else
149
- printf ("\t(unavailable: o_direct) \n" );
150
+ printf (NA_FORMAT , " o_direct" , "n/a \n" );
150
151
#endif
151
152
152
153
#else
153
- printf ("\t(unavailable: open_datasync) \n" );
154
+ printf (NA_FORMAT , " open_datasync" , "n/a \n" );
154
155
#endif
155
156
156
157
/*
@@ -180,7 +181,7 @@ main(int argc, char *argv[])
180
181
printf (LABEL_FORMAT , "open_sync 8k direct I/O write" );
181
182
fflush (stdout );
182
183
if ((tmpfile = open (filename , O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT , 0 )) == -1 )
183
- printf ("\t(unavailable: o_direct on this filesystem) \n" );
184
+ printf (NA_FORMAT , " o_direct" , "n/a on this filesystem\n" );
184
185
else
185
186
{
186
187
gettimeofday (& start_t , NULL );
@@ -196,11 +197,11 @@ main(int argc, char *argv[])
196
197
print_elapse (start_t , stop_t );
197
198
}
198
199
#else
199
- printf ("\t(unavailable: o_direct) \n" );
200
+ printf (NA_FORMAT , " o_direct" , "n/a \n" );
200
201
#endif
201
202
202
203
#else
203
- printf ("\t(unavailable: open_sync) \n" );
204
+ printf (NA_FORMAT , " open_sync" , "n/a \n" );
204
205
#endif
205
206
206
207
/*
@@ -224,7 +225,7 @@ main(int argc, char *argv[])
224
225
close (tmpfile );
225
226
print_elapse (start_t , stop_t );
226
227
#else
227
- printf ("\t(unavailable: fdatasync) \n" );
228
+ printf (NA_FORMAT , " fdatasync" , "n/a \n" );
228
229
#endif
229
230
230
231
/*
@@ -270,7 +271,7 @@ main(int argc, char *argv[])
270
271
close (tmpfile );
271
272
print_elapse (start_t , stop_t );
272
273
#else
273
- printf ("\t(unavailable: fsync_writethrough) \n" );
274
+ printf (NA_FORMAT , " fsync_writethrough" , "n/a \n" );
274
275
#endif
275
276
276
277
/*
@@ -320,11 +321,11 @@ main(int argc, char *argv[])
320
321
close (tmpfile );
321
322
print_elapse (start_t , stop_t );
322
323
#else
323
- printf ("\t(unavailable: o_direct) \n" );
324
+ printf (NA_FORMAT , " o_direct" "n/a \n" );
324
325
#endif
325
326
326
327
#else
327
- printf ("\t(unavailable: open_datasync) \n" );
328
+ printf (NA_FORMAT , " open_datasync" , "n/a \n" );
328
329
#endif
329
330
330
331
/*
@@ -368,11 +369,11 @@ main(int argc, char *argv[])
368
369
close (tmpfile );
369
370
print_elapse (start_t , stop_t );
370
371
#else
371
- printf ("\t(unavailable: o_direct) \n" );
372
+ printf (NA_FORMAT , " o_direct" , "n/a \n" );
372
373
#endif
373
374
374
375
#else
375
- printf ("\t(unavailable: open_sync) \n" );
376
+ printf (NA_FORMAT , " open_sync" , "n/a \n" );
376
377
#endif
377
378
378
379
/*
@@ -398,7 +399,7 @@ main(int argc, char *argv[])
398
399
close (tmpfile );
399
400
print_elapse (start_t , stop_t );
400
401
#else
401
- printf ("\t(unavailable: fdatasync) \n" );
402
+ printf (NA_FORMAT , " fdatasync" , "n/a \n" );
402
403
#endif
403
404
404
405
/*
@@ -448,7 +449,7 @@ main(int argc, char *argv[])
448
449
close (tmpfile );
449
450
print_elapse (start_t , stop_t );
450
451
#else
451
- printf ("\t(unavailable: fsync_writethrough) \n" );
452
+ printf (NA_FORMAT , " fsync_writethrough" , "n/a \n" );
452
453
#endif
453
454
454
455
/*
@@ -496,7 +497,7 @@ main(int argc, char *argv[])
496
497
close (tmpfile );
497
498
print_elapse (start_t , stop_t );
498
499
#else
499
- printf ("\t(unavailable: open_sync) \n" );
500
+ printf (NA_FORMAT , " open_sync" , "n/a \n" );
500
501
#endif
501
502
502
503
/*
@@ -581,7 +582,7 @@ print_elapse(struct timeval start_t, struct timeval stop_t)
581
582
(stop_t .tv_usec - start_t .tv_usec ) * 0.000001 ;
582
583
double per_second = loops / total_time ;
583
584
584
- printf ("%9.3f/second \n" , per_second );
585
+ printf ("%9.3f ops/sec \n" , per_second );
585
586
}
586
587
587
588
void
0 commit comments