Commit 22adbbe3 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: ignore first and classify other requests

Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent b4617fe5
...@@ -8,6 +8,7 @@ ioping \- simple disk I/O latency monitoring tool ...@@ -8,6 +8,7 @@ ioping \- simple disk I/O latency monitoring tool
.OP \-i interval .OP \-i interval
.OP \-l speed .OP \-l speed
.OP \-t time .OP \-t time
.OP \-T time
.OP \-s size .OP \-s size
.OP \-S wsize .OP \-S wsize
.OP \-o offset .OP \-o offset
...@@ -36,8 +37,12 @@ Set time between requests to \fIinterval\fR (\fB1s\fR). ...@@ -36,8 +37,12 @@ Set time between requests to \fIinterval\fR (\fB1s\fR).
Set \fIspeed\fR limit in bytes per second. Set interval to request-size / speed. Set \fIspeed\fR limit in bytes per second. Set interval to request-size / speed.
.TP .TP
.BI \-t \ time .BI \-t \ time
Minimal valid request time for cache misses (\fB0us\fR). Minimal valid request time (\fB0us\fR).
Cache hits are ignored in statistics. Too fast requests are ignored in statistics.
.TP
.BI \-T \ time
Maximum valid request time.
Too slow requests are ignored in statistics.
.TP .TP
.BI \-s \ size .BI \-s \ size
Request size (\fB4k\fR). Request size (\fB4k\fR).
......
...@@ -308,6 +308,7 @@ void usage(void) ...@@ -308,6 +308,7 @@ void usage(void)
" -i <interval> interval between requests (1s)\n" " -i <interval> interval between requests (1s)\n"
" -l <speed> speed limit in bytes per second\n" " -l <speed> speed limit in bytes per second\n"
" -t <time> minimal valid request time (0us)\n" " -t <time> minimal valid request time (0us)\n"
" -T <time> maximum valid request time\n"
" -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> working set offset (0)\n" " -o <offset> working set offset (0)\n"
...@@ -497,6 +498,7 @@ long long deadline = 0; ...@@ -497,6 +498,7 @@ long long deadline = 0;
long long speed_limit = 0; long long speed_limit = 0;
long long min_valid_time = 0; long long min_valid_time = 0;
long long max_valid_time = LLONG_MAX;
ssize_t default_size = 1<<12; ssize_t default_size = 1<<12;
ssize_t size = 0; ssize_t size = 0;
...@@ -521,7 +523,7 @@ void parse_options(int argc, char **argv) ...@@ -521,7 +523,7 @@ void parse_options(int argc, char **argv)
exit(1); exit(1);
} }
while ((opt = getopt(argc, argv, "hvkALRDCWGYBqyi:t:w:s:S:c:o:p:P:l:")) != -1) { while ((opt = getopt(argc, argv, "hvkALRDCWGYBqyi:t:T:w:s:S:c:o:p:P:l:")) != -1) {
switch (opt) { switch (opt) {
case 'h': case 'h':
usage(); usage();
...@@ -573,6 +575,9 @@ void parse_options(int argc, char **argv) ...@@ -573,6 +575,9 @@ void parse_options(int argc, char **argv)
case 't': case 't':
min_valid_time = parse_time(optarg); min_valid_time = parse_time(optarg);
break; break;
case 'T':
max_valid_time = parse_time(optarg);
break;
case 'w': case 'w':
deadline = parse_time(optarg); deadline = parse_time(optarg);
custom_deadline = 1; custom_deadline = 1;
...@@ -1064,6 +1069,7 @@ int main (int argc, char **argv) ...@@ -1064,6 +1069,7 @@ int main (int argc, char **argv)
int ret; int ret;
long long request, part_request; long long request, part_request;
long long too_fast = 0, too_slow = 0;
long long total_valid, part_valid; long long total_valid, part_valid;
long long time_start, time_total, this_time; long long time_start, time_total, this_time;
double part_min, part_max, time_min, time_max; double part_min, part_max, time_min, time_max;
...@@ -1299,7 +1305,13 @@ skip_preparation: ...@@ -1299,7 +1305,13 @@ skip_preparation:
this_time = time_now - this_time; this_time = time_now - this_time;
if (this_time >= min_valid_time) { if (request == 1) {
/* warmup */
} else if (this_time < min_valid_time) {
too_fast++;
} else if (this_time > max_valid_time) {
too_slow++;
} else {
part_valid++; part_valid++;
part_sum += this_time; part_sum += this_time;
part_sum2 += this_time * this_time; part_sum2 += this_time * this_time;
...@@ -1317,8 +1329,20 @@ skip_preparation: ...@@ -1317,8 +1329,20 @@ skip_preparation:
print_size(device_size); print_size(device_size);
printf("): request=%lu time=", (long unsigned)request); printf("): request=%lu time=", (long unsigned)request);
print_time(this_time); print_time(this_time);
if (this_time < min_valid_time) if (request == 1) {
printf(" (cache hit)"); printf(" (warmup)");
} else if (this_time < min_valid_time) {
printf(" (too fast)");
} else if (this_time > max_valid_time) {
printf(" (too slow)");
} else if (part_valid > 5 && part_min < part_max) {
int percent = (this_time - part_min) * 100 /
(part_max - part_min);
if (percent < 5)
printf(" (fast)");
else if (percent > 95)
printf(" (slow)");
}
printf("\n"); printf("\n");
} }
...@@ -1434,9 +1458,13 @@ skip_preparation: ...@@ -1434,9 +1458,13 @@ skip_preparation:
printf(" requests completed in "); printf(" requests completed in ");
print_time(time_sum); print_time(time_sum);
printf(", "); printf(", ");
if (total_valid < request) { if (too_fast) {
print_int(request - total_valid); print_int(too_fast);
printf(" cache hits, "); printf(" too fast, ");
}
if (too_slow) {
print_int(too_slow);
printf(" too slow, ");
} }
print_size((long long)total_valid * size); print_size((long long)total_valid * size);
printf(" %s, ", write_read_test ? "transferred" : printf(" %s, ", write_read_test ? "transferred" :
......
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