46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
--- a/src/stress.c
|
|
+++ b/src/stress.c
|
|
@@ -263,6 +263,7 @@ main (int argc, char **argv)
|
|
|
|
/* Calculate the backoff value so we get good fork throughput. */
|
|
backoff = do_backoff * forks;
|
|
+ struct timespec b = {backoff / 1000000, (backoff % 1000000) * 1000};
|
|
dbg (stdout, "using backoff sleep of %llius\n", backoff);
|
|
|
|
/* If we are supposed to respect a timeout, calculate it. */
|
|
@@ -297,7 +298,7 @@ main (int argc, char **argv)
|
|
{
|
|
case 0: /* child */
|
|
alarm (timeout);
|
|
- usleep (backoff);
|
|
+ nanosleep(&b, NULL);
|
|
if (do_dryrun)
|
|
exit (0);
|
|
exit (hogcpu ());
|
|
@@ -318,7 +319,7 @@ main (int argc, char **argv)
|
|
{
|
|
case 0: /* child */
|
|
alarm (timeout);
|
|
- usleep (backoff);
|
|
+ nanosleep(&b,&b);
|
|
if (do_dryrun)
|
|
exit (0);
|
|
exit (hogio ());
|
|
@@ -338,7 +339,7 @@ main (int argc, char **argv)
|
|
{
|
|
case 0: /* child */
|
|
alarm (timeout);
|
|
- usleep (backoff);
|
|
+ nanosleep(&b, &b);
|
|
if (do_dryrun)
|
|
exit (0);
|
|
exit (hogvm
|
|
@@ -359,7 +360,7 @@ main (int argc, char **argv)
|
|
{
|
|
case 0: /* child */
|
|
alarm (timeout);
|
|
- usleep (backoff);
|
|
+ nanosleep(&b, &b);
|
|
if (do_dryrun)
|
|
exit (0);
|
|
exit (hoghdd (do_hdd_bytes));
|