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
cbe930fe
Commit
cbe930fe
authored
May 30, 2011
by
Konstantin Khlebnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
randomization, fixing usage
parent
ae795c82
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
ioping.c
ioping.c
+22
-6
No files found.
ioping.c
View file @
cbe930fe
...
...
@@ -41,19 +41,20 @@
void
usage
(
void
)
{
fprintf
(
stderr
,
" Usage: ioping [-CDhq] [-c count] [-w deadline] [-p period]
\n
"
" Usage: ioping [-
R
CDhq] [-c count] [-w deadline] [-p period]
\n
"
" [-i interval] [-s size] [-S wsize] [-o offset] device|file|directory
\n
"
"
\n
"
" -c <count> stop after <count> requests
\n
"
" -w <deadline> stop after <deadline>
\n
"
" -p <period> print raw statistics for every <period> requests
\n
"
" -i <interval> interval between requests
\n
"
" -s <size> request size
\n
"
" -S <wsize> working set size
\n
"
" -i <interval> interval between requests
(1s)
\n
"
" -s <size> request size
(4k)
\n
"
" -S <wsize> working set size
(1m)
\n
"
" -o <offset> in file offset
\n
"
" -R use random offsets in the work set
\n
"
" -C use cached-io
\n
"
" -D use direct-io
\n
"
" -h display this mesage and exit
\n
"
" -h display this mes
s
age and exit
\n
"
" -q suppress human-readable output
\n
"
"
\n
"
);
...
...
@@ -174,6 +175,7 @@ int quiet = 0;
int
period
=
0
;
int
direct
=
0
;
int
cached
=
0
;
int
randomize
=
0
;
long
long
interval
=
1000000
;
long
long
deadline
=
0
;
...
...
@@ -196,10 +198,13 @@ void parse_options(int argc, char **argv)
if
(
argc
<
2
)
usage
();
while
((
opt
=
getopt
(
argc
,
argv
,
"-hDCqi:w:s:S:c:o:p:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"-h
R
DCqi:w:s:S:c:o:p:"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
usage
();
case
'R'
:
randomize
=
1
;
break
;
case
'D'
:
direct
=
1
;
break
;
...
...
@@ -378,6 +383,14 @@ int main (int argc, char **argv)
err
(
1
,
"failed to open
\"
%s
\"
"
,
path
);
}
if
(
!
cached
)
{
ret
=
posix_fadvise
(
fd
,
offset
,
wsize
,
POSIX_FADV_RANDOM
);
if
(
ret
)
err
(
1
,
"fadvise failed"
);
}
srandom
(
now
());
if
(
deadline
)
deadline
+=
now
();
...
...
@@ -401,6 +414,9 @@ int main (int argc, char **argv)
request
++
;
if
(
randomize
)
woffset
=
random
()
%
(
wsize
/
size
)
*
size
;
if
(
!
cached
)
{
ret
=
posix_fadvise
(
fd
,
offset
+
woffset
,
size
,
POSIX_FADV_DONTNEED
);
...
...
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