Commit b300ee33 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: use nanosleep to sleep

Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent 9d08f3c3
...@@ -230,6 +230,7 @@ int period_request = 0; ...@@ -230,6 +230,7 @@ int period_request = 0;
long long period_time = 0; long long period_time = 0;
long long interval = 1000000; long long interval = 1000000;
struct timespec interval_ts;
long long deadline = 0; long long deadline = 0;
ssize_t size = 1<<12; ssize_t size = 1<<12;
...@@ -572,6 +573,9 @@ int main (int argc, char **argv) ...@@ -572,6 +573,9 @@ int main (int argc, char **argv)
parse_options(argc, argv); parse_options(argc, argv);
interval_ts.tv_sec = interval / 1000000;
interval_ts.tv_nsec = (interval % 1000000) * 1000;
if (wsize) if (wsize)
temp_wsize = wsize; temp_wsize = wsize;
else if (size > temp_wsize) else if (size > temp_wsize)
...@@ -788,7 +792,7 @@ int main (int argc, char **argv) ...@@ -788,7 +792,7 @@ int main (int argc, char **argv)
break; break;
if (interval) if (interval)
usleep(interval); nanosleep(&interval_ts, NULL);
} }
time_total = now() - time_total; time_total = now() - time_total;
......
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