Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioping
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ioping
Commits
b4617fe5
Commit
b4617fe5
authored
Oct 29, 2016
by
Konstantin Khlebnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ioping: add read-write mode
Signed-off-by:
Konstantin Khlebnikov
<
koct9i@gmail.com
>
parent
0d79bd8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
10 deletions
+27
-10
ioping.1
ioping.1
+4
-1
ioping.c
ioping.c
+23
-9
No files found.
ioping.1
View file @
b4617fe5
...
...
@@ -3,7 +3,7 @@
ioping \- simple disk I/O latency monitoring tool
.SH SYNOPSYS
.SY ioping
.OP \-ABCDLRWYykq
.OP \-ABCDLRW
G
Yykq
.OP \-c count
.OP \-i interval
.OP \-l speed
...
...
@@ -87,6 +87,9 @@ more reliable results for systems where non-cached reads are not supported or
cached at some level. Might be \fB*DANGEROUS*\fR for file/device: it will
shred your data. In this case should be repeated tree times (\fB-WWW\fR).
.TP
.B \-G
Alternate read and write requests.
.TP
.B \-Y
Use sync I/O (see \fBO_SYNC\fR in \fBopen\fR(2)).
.TP
...
...
ioping.c
View file @
b4617fe5
...
...
@@ -321,6 +321,7 @@ void usage(void)
" -R seek rate test
\n
"
" -L use sequential operations
\n
"
" -W use write I/O (please read manpage)
\n
"
" -G read-write ping-pong mode
\n
"
" -Y use sync I/O (O_SYNC)
\n
"
" -y use data sync I/O (O_DSYNC)
\n
"
" -k keep and reuse temporary file (ioping.tmp)
\n
"
...
...
@@ -484,8 +485,7 @@ int syncio = 0;
int
data_syncio
=
0
;
int
randomize
=
1
;
int
write_test
=
0
;
ssize_t
(
*
make_request
)
(
int
fd
,
void
*
buf
,
size_t
nbytes
,
off_t
offset
)
=
pread
;
int
write_read_test
=
0
;
long
long
period_request
=
0
;
long
long
period_time
=
0
;
...
...
@@ -521,7 +521,7 @@ void parse_options(int argc, char **argv)
exit
(
1
);
}
while
((
opt
=
getopt
(
argc
,
argv
,
"hvkALRDCWYBqyi:t:w:s:S:c:o:p:P:l:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"hvkALRDCW
G
YBqyi:t:w:s:S:c:o:p:P:l:"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
usage
();
...
...
@@ -556,6 +556,10 @@ void parse_options(int argc, char **argv)
case
'W'
:
write_test
++
;
break
;
case
'G'
:
write_test
++
;
write_read_test
=
1
;
break
;
case
'Y'
:
syncio
=
1
;
break
;
...
...
@@ -750,6 +754,10 @@ ssize_t do_pwrite(int fd, void *buf, size_t nbytes, off_t offset)
return
ret
;
}
ssize_t
(
*
make_pread
)
(
int
fd
,
void
*
buf
,
size_t
nbytes
,
off_t
offset
)
=
pread
;
ssize_t
(
*
make_pwrite
)
(
int
fd
,
void
*
buf
,
size_t
nbytes
,
off_t
offset
)
=
do_pwrite
;
ssize_t
(
*
make_request
)
(
int
fd
,
void
*
buf
,
size_t
nbytes
,
off_t
offset
)
=
pread
;
#ifdef HAVE_LINUX_ASYNC_IO
#include <sys/syscall.h>
...
...
@@ -851,7 +859,8 @@ static void aio_setup(void)
if
(
io_setup
(
1
,
&
aio_ctx
))
err
(
2
,
"aio setup failed"
);
make_request
=
write_test
?
aio_pwrite
:
aio_pread
;
make_pread
=
aio_pread
;
make_pwrite
=
aio_pwrite
;
}
#else
...
...
@@ -1104,12 +1113,11 @@ int main (int argc, char **argv)
# endif
#endif
if
(
write_test
)
make_request
=
do_pwrite
;
if
(
async
)
aio_setup
();
make_request
=
write_test
?
make_pwrite
:
make_pread
;
#ifndef HAVE_DIRECT_IO
if
(
direct
)
errx
(
1
,
"direct I/O not supported by this platform"
);
...
...
@@ -1264,6 +1272,11 @@ skip_preparation:
}
#endif
if
(
write_read_test
)
{
write_test
=
request
&
1
;
make_request
=
write_test
?
make_pwrite
:
make_pread
;
}
if
(
write_test
)
random_memory
(
buf
,
size
);
...
...
@@ -1298,7 +1311,7 @@ skip_preparation:
if
(
!
quiet
)
{
print_size
(
ret_size
);
printf
(
" %s %s (%s %s"
,
write_test
?
"
to"
:
"from
"
,
printf
(
" %s %s (%s %s"
,
write_test
?
"
>>>"
:
"<<<
"
,
path
,
fstype
,
device
);
if
(
device_size
)
print_size
(
device_size
);
...
...
@@ -1426,7 +1439,8 @@ skip_preparation:
printf
(
" cache hits, "
);
}
print_size
((
long
long
)
total_valid
*
size
);
printf
(
" %s, "
,
write_test
?
"written"
:
"read"
);
printf
(
" %s, "
,
write_read_test
?
"transferred"
:
write_test
?
"written"
:
"read"
);
print_int
(
1
.
*
NSEC_PER_SEC
*
total_valid
/
time_sum
);
printf
(
" iops, "
);
print_size
(
1
.
*
NSEC_PER_SEC
*
total_valid
*
size
/
time_sum
);
...
...
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