]> sourceware.org Git - systemtap.git/commitdiff
testsuite/systemtap.base/sdt_misc.c: nanosleep in endless loop.
authorMark Wielaard <mjw@redhat.com>
Mon, 14 Nov 2011 10:36:32 +0000 (11:36 +0100)
committerMark Wielaard <mjw@redhat.com>
Mon, 14 Nov 2011 10:36:32 +0000 (11:36 +0100)
Be nice to single CPU or low resource devices running this testcase.

testsuite/systemtap.base/sdt_misc.c

index ecc78ffaf468f59dae0de57f2c3d4776f219b9b9..aeab62fc11de0058acdb79fd5a636d146b876d49 100644 (file)
@@ -1,6 +1,11 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <time.h>
+
+#ifdef LOOP
+static struct timespec req = {0, 200000000};
+#endif
 
 #ifndef ONLY_MAIN
 #include "sdt_misc_.h"
@@ -28,6 +33,7 @@ bar (int i)
 #ifdef LOOP
   while (!loop_check())
     {
+      nanosleep(&req, NULL);
     }
 #endif
 #ifndef NO_SLEEP
@@ -99,7 +105,7 @@ main ()
   baz(3,(char*)"abc");
   buz(4);
 #ifdef LOOP
-  while (1) {}
+  while (1) {nanosleep(&req, NULL);}
 #endif
   return 0;
 }
This page took 0.028311 seconds and 5 git commands to generate.