Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
6dc15e3b
Commit
6dc15e3b
authored
14 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Use O_DIRECT in O_SYNC test of different size. Restructure O_DIRECT
error reporting to be more consistent.
parent
3eebb33d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tools/fsync/test_fsync.c
+45
-41
45 additions, 41 deletions
src/tools/fsync/test_fsync.c
with
45 additions
and
41 deletions
src/tools/fsync/test_fsync.c
+
45
−
41
View file @
6dc15e3b
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
#define WRITE_SIZE (8 * 1024)
/* 8k */
#define WRITE_SIZE (8 * 1024)
/* 8k */
#define LABEL_FORMAT " %-32s"
#define LABEL_FORMAT
" %-32s"
#define NA_FORMAT LABEL_FORMAT "%18s"
#define NA_FORMAT
LABEL_FORMAT "%18s"
int
ops_per_test
=
2000
;
int
ops_per_test
=
2000
;
...
@@ -365,12 +365,6 @@ test_sync(int writes_per_op)
...
@@ -365,12 +365,6 @@ test_sync(int writes_per_op)
* If O_DIRECT is enabled, test that with open_sync
* If O_DIRECT is enabled, test that with open_sync
*/
*/
#if PG_O_DIRECT != 0
#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
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
|
PG_O_DIRECT
,
0
))
==
-
1
)
{
{
printf
(
NA_FORMAT
,
"o_direct"
,
"n/a**
\n
"
);
printf
(
NA_FORMAT
,
"o_direct"
,
"n/a**
\n
"
);
...
@@ -378,6 +372,12 @@ test_sync(int writes_per_op)
...
@@ -378,6 +372,12 @@ test_sync(int writes_per_op)
}
}
else
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
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
...
@@ -423,47 +423,51 @@ test_open_syncs(void)
...
@@ -423,47 +423,51 @@ test_open_syncs(void)
printf
(
"(This is designed to compare the cost of one large
\n
"
);
printf
(
"(This is designed to compare the cost of one large
\n
"
);
printf
(
"sync'ed write and two smaller sync'ed writes.)
\n
"
);
printf
(
"sync'ed write and two smaller sync'ed writes.)
\n
"
);
/* XXX no PG_O_DIRECT */
/*
/*
* Test open_sync with different size files
* Test open_sync with different size files
*/
*/
#ifdef OPEN_SYNC_FLAG
#ifdef OPEN_SYNC_FLAG
printf
(
LABEL_FORMAT
,
"open_sync 16k write"
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
|
PG_O_DIRECT
,
0
))
==
-
1
)
fflush
(
stdout
);
printf
(
NA_FORMAT
,
"o_direct"
,
"n/a**
\n
"
);
else
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
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
*
2
)
!=
WRITE_SIZE
*
2
)
printf
(
LABEL_FORMAT
,
"open_sync 16k write"
);
die
(
"write failed"
);
fflush
(
stdout
);
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
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
,
0
))
==
-
1
)
gettimeofday
(
&
start_t
,
NULL
);
die
(
"Cannot open output file."
);
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
)
printf
(
LABEL_FORMAT
,
"2 open_sync 8k writes"
);
die
(
"write failed"
);
fflush
(
stdout
);
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
die
(
"write failed"
);
gettimeofday
(
&
start_t
,
NULL
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
die
(
"seek failed"
);
{
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
#else
printf
(
NA_FORMAT
,
"open_sync"
,
"n/a
\n
"
);
printf
(
NA_FORMAT
,
"open_sync"
,
"n/a
\n
"
);
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment