You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB

  1. --- a/src/stress.c
  2. +++ b/src/stress.c
  3. @@ -262,6 +262,7 @@ main (int argc, char **argv)
  4. /* Calculate the backoff value so we get good fork throughput. */
  5. backoff = do_backoff * forks;
  6. + struct timespec b = {backoff / 1000000, (backoff % 1000000) * 1000};
  7. dbg (stdout, "using backoff sleep of %llius\n", backoff);
  8. /* If we are supposed to respect a timeout, calculate it. */
  9. @@ -296,7 +297,7 @@ main (int argc, char **argv)
  10. {
  11. case 0: /* child */
  12. alarm (timeout);
  13. - usleep (backoff);
  14. + nanosleep(&b, NULL);
  15. if (do_dryrun)
  16. exit (0);
  17. exit (hogcpu ());
  18. @@ -317,7 +318,7 @@ main (int argc, char **argv)
  19. {
  20. case 0: /* child */
  21. alarm (timeout);
  22. - usleep (backoff);
  23. + nanosleep(&b,&b);
  24. if (do_dryrun)
  25. exit (0);
  26. exit (hogio ());
  27. @@ -337,7 +338,7 @@ main (int argc, char **argv)
  28. {
  29. case 0: /* child */
  30. alarm (timeout);
  31. - usleep (backoff);
  32. + nanosleep(&b, &b);
  33. if (do_dryrun)
  34. exit (0);
  35. exit (hogvm
  36. @@ -358,7 +359,7 @@ main (int argc, char **argv)
  37. {
  38. case 0: /* child */
  39. alarm (timeout);
  40. - usleep (backoff);
  41. + nanosleep(&b, &b);
  42. if (do_dryrun)
  43. exit (0);
  44. exit (hoghdd (do_hdd_bytes));