Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2330d9c

Browse files
committed
Simplify test_fsync duration computation.
1 parent7341a8c commit2330d9c

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

‎src/tools/fsync/test_fsync.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.28 2010/07/0401:50:29 momjian Exp $
2+
* $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.29 2010/07/0413:42:51 momjian Exp $
33
*
44
*
55
*test_fsync.c
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
7979
/*
8080
* Simple write
8181
*/
82-
printf("Simple write timing:\n");
82+
printf("Simple write:\n");
8383
/* write only */
8484
gettimeofday(&start_t,NULL);
8585
for (i=0;i<loops;i++)
@@ -271,7 +271,7 @@ main(int argc, char *argv[])
271271
/*
272272
* Compare 1 to 2 writes
273273
*/
274-
printf("\nCompare open_sync sizes:\n");
274+
printf("\nCompare open_syncwith differentsizes:\n");
275275

276276
#ifdefOPEN_SYNC_FLAG
277277
/* 16k open_sync write */
@@ -368,17 +368,10 @@ main(int argc, char *argv[])
368368
void
369369
print_elapse(structtimevalstart_t,structtimevalstop_t)
370370
{
371-
doubletotal_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+
doubletotal_time= (stop_t.tv_sec-start_t.tv_sec)+
372+
/* usec subtraction might be negative, e.g. 5.4 - 4.8 */
380373
(stop_t.tv_usec-start_t.tv_usec)*0.000001;
381-
per_second=loops /total_time;
374+
doubleper_second=loops /total_time;
382375

383376
printf("%9.3f/second\n",per_second);
384377
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp