Commit fa5463c6 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

Use random operations by defult, add -L option for sequential.

parent 967eeb5f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.SH NAME .SH NAME
ioping \- simple disk I/O latency monitoring tool ioping \- simple disk I/O latency monitoring tool
.SH SYNOPSYS .SH SYNOPSYS
\fBioping\fR [\fB\-RCDhq\fR] [\fB\-c \fIcount\fR] [\fB\-w \fIdeadline\fR] \ \fBioping\fR [\fB\-LCDhq\fR] [\fB\-c \fIcount\fR] [\fB\-w \fIdeadline\fR] \
[\fB\-p \fIperiod\fR] [\fB\-i \fIinterval\fR] [\fB\-s \fIsize\fR] \ [\fB\-p \fIperiod\fR] [\fB\-i \fIinterval\fR] [\fB\-s \fIsize\fR] \
[\fB\-S \fIwsize\fR] [\fB\-o \fIoffset\fR] \ [\fB\-S \fIwsize\fR] [\fB\-o \fIoffset\fR] \
\fIdevice\fR | \fIfile\fR | \fIdirectory\fR \fIdevice\fR | \fIfile\fR | \fIdirectory\fR
...@@ -31,8 +31,8 @@ Working set size. ...@@ -31,8 +31,8 @@ Working set size.
\fB\-o\fR \fIoffset\fR \fB\-o\fR \fIoffset\fR
Offset in input file. Offset in input file.
.TP .TP
\fB\-R\fR \fB\-L\fR
Use random offsets in the work set. Use sequential operations rather than random.
.TP .TP
\fB\-C\fR \fB\-C\fR
Use cached I/O. Use cached I/O.
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
void usage(void) void usage(void)
{ {
fprintf(stderr, fprintf(stderr,
" Usage: ioping [-RCDhq] [-c count] [-w deadline] [-p period] [-i interval]\n" " Usage: ioping [-LCDhq] [-c count] [-w deadline] [-p period] [-i interval]\n"
" [-s size] [-S wsize] [-o offset] device|file|directory\n" " [-s size] [-S wsize] [-o offset] device|file|directory\n"
"\n" "\n"
" -c <count> stop after <count> requests\n" " -c <count> stop after <count> requests\n"
...@@ -51,7 +51,7 @@ void usage(void) ...@@ -51,7 +51,7 @@ void usage(void)
" -s <size> request size (4k)\n" " -s <size> request size (4k)\n"
" -S <wsize> working set size (1m)\n" " -S <wsize> working set size (1m)\n"
" -o <offset> in file offset\n" " -o <offset> in file offset\n"
" -R use random offsets in the work set\n" " -L use sequential operations rather than random\n"
" -C use cached-io\n" " -C use cached-io\n"
" -D use direct-io\n" " -D use direct-io\n"
" -h display this message and exit\n" " -h display this message and exit\n"
...@@ -175,7 +175,7 @@ int quiet = 0; ...@@ -175,7 +175,7 @@ int quiet = 0;
int period = 0; int period = 0;
int direct = 0; int direct = 0;
int cached = 0; int cached = 0;
int randomize = 0; int randomize = 1;
long long interval = 1000000; long long interval = 1000000;
long long deadline = 0; long long deadline = 0;
...@@ -198,12 +198,12 @@ void parse_options(int argc, char **argv) ...@@ -198,12 +198,12 @@ void parse_options(int argc, char **argv)
if (argc < 2) if (argc < 2)
usage(); usage();
while ((opt = getopt(argc, argv, "-hRDCqi:w:s:S:c:o:p:")) != -1) { while ((opt = getopt(argc, argv, "-hLDCqi:w:s:S:c:o:p:")) != -1) {
switch (opt) { switch (opt) {
case 'h': case 'h':
usage(); usage();
case 'R': case 'L':
randomize = 1; randomize = 0;
break; break;
case 'D': case 'D':
direct = 1; direct = 1;
...@@ -458,9 +458,11 @@ int main (int argc, char **argv) ...@@ -458,9 +458,11 @@ int main (int argc, char **argv)
part_sum = part_sum2 = 0; part_sum = part_sum2 = 0;
} }
woffset += size; if (!randomize) {
if (woffset + size > wsize) woffset += size;
woffset = 0; if (woffset + size > wsize)
woffset = 0;
}
if (exiting) if (exiting)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment