Commit 9ffe820b authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

* ioping -c|-w: do not oversleep

This commit addresses two similar (but distinct) bugs.

(1) 'ioping -c' was needlessly sleeping after the last iteration
(and before showing final stats). Fix it by moving the check
to before the usleep(), not after.

(2) 'ioping -w' was going over the time limit specified. For example,
'ioping -w 7 -i 2' was taking 8 seconds to run, not 7 or less.
Fix it by moving the check to before usleep(), and taking
the interval (ie usleep argument) into account.
Signed-off-by: default avatarKir Kolyshkin <kir@openvz.org>
parent 143c6969
...@@ -406,13 +406,7 @@ int main (int argc, char **argv) ...@@ -406,13 +406,7 @@ int main (int argc, char **argv)
part_sum2 = time_sum2 = 0; part_sum2 = time_sum2 = 0;
time_total = now(); time_total = now();
while (!exiting) { while (1) {
if (count && request >= count)
break;
if (deadline && now() >= deadline)
break;
request++; request++;
if (randomize) if (randomize)
...@@ -466,7 +460,15 @@ int main (int argc, char **argv) ...@@ -466,7 +460,15 @@ int main (int argc, char **argv)
if (woffset + size > wsize) if (woffset + size > wsize)
woffset = 0; woffset = 0;
if (!exiting) if (exiting)
break;
if (count && request >= count)
break;
if (deadline && now() >= deadline)
break;
usleep(interval); usleep(interval);
} }
......
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