|
1 | 1 | /* |
2 | | - * $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.28 2010/07/04 01:50:29 momjian Exp $ |
| 2 | + * $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.29 2010/07/04 13:42:51 momjian Exp $ |
3 | 3 | * |
4 | 4 | * |
5 | 5 | * test_fsync.c |
@@ -79,7 +79,7 @@ main(int argc, char *argv[]) |
79 | 79 | /* |
80 | 80 | * Simple write |
81 | 81 | */ |
82 | | - printf("Simple write timing:\n"); |
| 82 | + printf("Simple write:\n"); |
83 | 83 | /* write only */ |
84 | 84 | gettimeofday(&start_t, NULL); |
85 | 85 | for (i = 0; i < loops; i++) |
@@ -271,7 +271,7 @@ main(int argc, char *argv[]) |
271 | 271 | /* |
272 | 272 | * Compare 1 to 2 writes |
273 | 273 | */ |
274 | | - printf("\nCompare open_sync sizes:\n"); |
| 274 | + printf("\nCompare open_sync with different sizes:\n"); |
275 | 275 |
|
276 | 276 | #ifdef OPEN_SYNC_FLAG |
277 | 277 | /* 16k open_sync write */ |
@@ -368,17 +368,10 @@ main(int argc, char *argv[]) |
368 | 368 | void |
369 | 369 | print_elapse(struct timeval start_t, struct timeval stop_t) |
370 | 370 | { |
371 | | - double total_time, per_second; |
372 | | - |
373 | | - if (stop_t.tv_usec < start_t.tv_usec) |
374 | | - { |
375 | | - stop_t.tv_sec--; |
376 | | - stop_t.tv_usec += 1000000; |
377 | | - } |
378 | | - |
379 | | - total_time = (stop_t.tv_sec - start_t.tv_sec) + |
| 371 | + double total_time = (stop_t.tv_sec - start_t.tv_sec) + |
| 372 | + /* usec subtraction might be negative, e.g. 5.4 - 4.8 */ |
380 | 373 | (stop_t.tv_usec - start_t.tv_usec) * 0.000001; |
381 | | - per_second = loops / total_time; |
| 374 | + double per_second = loops / total_time; |
382 | 375 |
|
383 | 376 | printf("%9.3f/second\n", per_second); |
384 | 377 | } |
|
0 commit comments