Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
bae82835
Commit
bae82835
authored
Jul 13, 2010
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print each test_fsync description while test is running, rather than at
the end.
parent
804f96ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
src/tools/fsync/test_fsync.c
src/tools/fsync/test_fsync.c
+33
-33
No files found.
src/tools/fsync/test_fsync.c
View file @
bae82835
/*
* $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.3
0 2010/07/06 19:19:02
momjian Exp $
* $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.3
1 2010/07/13 17:00:50
momjian Exp $
*
*
* test_fsync.c
...
...
@@ -80,7 +80,8 @@ main(int argc, char *argv[])
* Simple write
*/
printf
(
"Simple write:
\n
"
);
/* write only */
printf
(
LABEL_FORMAT
,
"8k write"
);
fflush
(
stdout
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -91,7 +92,6 @@ main(int argc, char *argv[])
close
(
tmpfile
);
}
gettimeofday
(
&
stop_t
,
NULL
);
printf
(
LABEL_FORMAT
,
"8k write"
);
print_elapse
(
start_t
,
stop_t
);
/*
...
...
@@ -100,7 +100,8 @@ main(int argc, char *argv[])
printf
(
"
\n
Compare file sync methods using one write:
\n
"
);
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
printf
(
LABEL_FORMAT
,
"open_datasync 8k write"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_DSYNC
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -113,14 +114,14 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"open_datasync 8k write"
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
"
\t
(
open_datasync unavailable
)
\n
"
);
printf
(
"
\t
(
unavailable: open_datasync
)
\n
"
);
#endif
#ifdef OPEN_SYNC_FLAG
/* open_fsync, write */
printf
(
LABEL_FORMAT
,
"open_sync 8k write"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -133,14 +134,14 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"open_sync 8k write"
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
"
\t
(
open_sync unavailable
)
\n
"
);
printf
(
"
\t
(
unavailable: open_sync
)
\n
"
);
#endif
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
printf
(
LABEL_FORMAT
,
"8k write, fdatasync"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -154,13 +155,13 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"8k write, fdatasync"
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
"
\t
(
fdatasync unavailable
)
\n
"
);
printf
(
"
\t
(
unavailable: fdatasync
)
\n
"
);
#endif
/* write, fsync, close */
printf
(
LABEL_FORMAT
,
"8k write, fsync"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -175,7 +176,6 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"8k write, fsync"
);
print_elapse
(
start_t
,
stop_t
);
/*
...
...
@@ -184,7 +184,8 @@ main(int argc, char *argv[])
printf
(
"
\n
Compare file sync methods using two writes:
\n
"
);
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
printf
(
LABEL_FORMAT
,
"2 open_datasync 8k writes"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_DSYNC
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -199,14 +200,14 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"2 open_datasync 8k writes"
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
"
\t
(
open_datasync unavailable
)
\n
"
);
printf
(
"
\t
(
unavailable: open_datasync
)
\n
"
);
#endif
#ifdef OPEN_SYNC_FLAG
/* open_fsync, write */
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -221,12 +222,12 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
print_elapse
(
start_t
,
stop_t
);
#endif
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
printf
(
LABEL_FORMAT
,
"8k write, 8k write, fdatasync"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -242,13 +243,13 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"8k write, 8k write, fdatasync"
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
"
\t
(
fdatasync unavailable
)
\n
"
);
printf
(
"
\t
(
unavailable: fdatasync
)
\n
"
);
#endif
/* write, fsync, close */
printf
(
LABEL_FORMAT
,
"8k write, 8k write, fsync"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -265,7 +266,6 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"8k write, 8k write, fsync"
);
print_elapse
(
start_t
,
stop_t
);
/*
...
...
@@ -274,7 +274,8 @@ main(int argc, char *argv[])
printf
(
"
\n
Compare open_sync with different sizes:
\n
"
);
#ifdef OPEN_SYNC_FLAG
/* 16k open_sync write */
printf
(
LABEL_FORMAT
,
"open_sync 16k write"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -287,10 +288,10 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"open_sync 16k write"
);
print_elapse
(
start_t
,
stop_t
);
/* Two 8k open_sync writes */
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
,
0
))
==
-
1
)
die
(
"Cannot open output file."
);
gettimeofday
(
&
start_t
,
NULL
);
...
...
@@ -305,10 +306,9 @@ main(int argc, char *argv[])
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
"
\t
(
open_sync unavailable
)
\n
"
);
printf
(
"
\t
(
unavailable: open_sync
)
\n
"
);
#endif
/*
...
...
@@ -318,7 +318,8 @@ main(int argc, char *argv[])
printf
(
"(If the times are similar, fsync() can sync data written
\n
"
);
printf
(
"on a different descriptor.)
\n
"
);
/* write, fsync, close */
printf
(
LABEL_FORMAT
,
"8k write, fsync, close"
);
fflush
(
stdout
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -335,10 +336,10 @@ main(int argc, char *argv[])
close
(
tmpfile
);
}
gettimeofday
(
&
stop_t
,
NULL
);
printf
(
LABEL_FORMAT
,
"8k write, fsync, close"
);
print_elapse
(
start_t
,
stop_t
);
/* write, close, fsync */
printf
(
LABEL_FORMAT
,
"8k write, close, fsync"
);
fflush
(
stdout
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -355,7 +356,6 @@ main(int argc, char *argv[])
close
(
tmpfile
);
}
gettimeofday
(
&
stop_t
,
NULL
);
printf
(
LABEL_FORMAT
,
"8k write, close, fsync"
);
print_elapse
(
start_t
,
stop_t
);
/* cleanup */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment