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
6dc15e3b
Commit
6dc15e3b
authored
Jan 15, 2011
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use O_DIRECT in O_SYNC test of different size. Restructure O_DIRECT
error reporting to be more consistent.
parent
3eebb33d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
41 deletions
+45
-41
src/tools/fsync/test_fsync.c
src/tools/fsync/test_fsync.c
+45
-41
No files found.
src/tools/fsync/test_fsync.c
View file @
6dc15e3b
...
...
@@ -31,8 +31,8 @@
#define WRITE_SIZE (8 * 1024)
/* 8k */
#define LABEL_FORMAT " %-32s"
#define NA_FORMAT LABEL_FORMAT "%18s"
#define LABEL_FORMAT
" %-32s"
#define NA_FORMAT
LABEL_FORMAT "%18s"
int
ops_per_test
=
2000
;
...
...
@@ -365,12 +365,6 @@ test_sync(int writes_per_op)
* If O_DIRECT is enabled, test that with open_sync
*/
#if PG_O_DIRECT != 0
if
(
writes_per_op
==
1
)
printf
(
LABEL_FORMAT
,
"open_sync 8k direct I/O write"
);
else
printf
(
LABEL_FORMAT
,
"2 open_sync 8k direct I/O writes"
);
fflush
(
stdout
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
|
PG_O_DIRECT
,
0
))
==
-
1
)
{
printf
(
NA_FORMAT
,
"o_direct"
,
"n/a**
\n
"
);
...
...
@@ -378,6 +372,12 @@ test_sync(int writes_per_op)
}
else
{
if
(
writes_per_op
==
1
)
printf
(
LABEL_FORMAT
,
"open_sync 8k direct I/O write"
);
else
printf
(
LABEL_FORMAT
,
"2 open_sync 8k direct I/O writes"
);
fflush
(
stdout
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
...
...
@@ -423,47 +423,51 @@ test_open_syncs(void)
printf
(
"(This is designed to compare the cost of one large
\n
"
);
printf
(
"sync'ed write and two smaller sync'ed writes.)
\n
"
);
/* XXX no PG_O_DIRECT */
/*
* Test open_sync with different size files
*/
#ifdef OPEN_SYNC_FLAG
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
);
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
|
PG_O_DIRECT
,
0
))
==
-
1
)
printf
(
NA_FORMAT
,
"o_direct"
,
"n/a**
\n
"
);
else
{
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
*
2
)
!=
WRITE_SIZE
*
2
)
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
print_elapse
(
start_t
,
stop_t
);
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
fflush
(
stdout
);
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
);
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
gettimeofday
(
&
start_t
,
NULL
);
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
*
2
)
!=
WRITE_SIZE
*
2
)
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
print_elapse
(
start_t
,
stop_t
);
}
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
|
PG_O_DIRECT
,
0
))
==
-
1
)
printf
(
NA_FORMAT
,
"n/a**
\n
"
);
else
{
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
die
(
"write failed"
);
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
fflush
(
stdout
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
die
(
"write failed"
);
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
print_elapse
(
start_t
,
stop_t
);
}
gettimeofday
(
&
stop_t
,
NULL
);
close
(
tmpfile
);
print_elapse
(
start_t
,
stop_t
);
#else
printf
(
NA_FORMAT
,
"open_sync"
,
"n/a
\n
"
);
#endif
...
...
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