0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-12 04:38:06 +00:00
packages/utils/stress/patches/010-usleep.patch
Alexandru Ardelean 815674151e stress: bump to version 1.0.7
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
2023-02-06 13:19:10 +02:00

52 lines
1.9 KiB
Diff

--- a/src/stress.c
+++ b/src/stress.c
@@ -266,9 +266,12 @@ main (int argc, char **argv)
while ((forks = (do_cpu + do_io + do_vm + do_hdd)))
{
long long backoff, timeout = 0;
+ struct timespec b;
/* Calculate the backoff value so we get good fork throughput. */
backoff = do_backoff * forks;
+ b.tv_sec = backoff / 1000000;
+ b.tv_nsec = (backoff % 1000000) * 1000;
dbg (stdout, "using backoff sleep of %llius\n", backoff);
/* If we are supposed to respect a timeout, calculate it. */
@@ -304,7 +307,7 @@ main (int argc, char **argv)
case 0: /* child */
worker_init();
alarm (timeout);
- usleep (backoff);
+ nanosleep (&b, NULL);
if (do_dryrun)
exit (0);
exit (hogcpu ());
@@ -326,7 +329,7 @@ main (int argc, char **argv)
case 0: /* child */
worker_init();
alarm (timeout);
- usleep (backoff);
+ nanosleep (&b, NULL);
if (do_dryrun)
exit (0);
exit (hogio ());
@@ -347,7 +350,7 @@ main (int argc, char **argv)
case 0: /* child */
worker_init();
alarm (timeout);
- usleep (backoff);
+ nanosleep (&b, NULL);
if (do_dryrun)
exit (0);
exit (hogvm (do_vm_bytes, do_vm_stride, do_vm_hang, do_vm_keep));
@@ -368,7 +371,7 @@ main (int argc, char **argv)
case 0: /* child */
worker_init();
alarm (timeout);
- usleep (backoff);
+ nanosleep (&b, NULL);
if (do_dryrun)
exit (0);
exit (hoghdd (do_hdd_bytes));