Delay reader in loops, not us
[urcu.git] / test_qsbr.c
index 7ff1aca9c7600994f5b2ad30d79d0ca7fd3a0e60..488c9041b1aae96d267aa6ea8e3ec4f027fc3032 100644 (file)
@@ -65,9 +65,15 @@ static struct test_array *test_rcu_pointer;
 
 static unsigned long duration;
 
 
 static unsigned long duration;
 
-/* read-side C.S. duration, in us */
+/* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
 static unsigned long rduration;
 
+static inline void loop_sleep(unsigned long l)
+{
+       while(l-- != 0)
+               cpu_relax();
+}
+
 /*
  * returns 0 if test should end.
  */
 /*
  * returns 0 if test should end.
  */
@@ -168,7 +174,7 @@ void *thr_reader(void *_count)
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (unlikely(rduration))
                if (local_ptr)
                        assert(local_ptr->a == 8);
                if (unlikely(rduration))
-                       usleep(rduration);
+                       loop_sleep(rduration);
                _rcu_read_unlock();
                nr_reads++;
                /* QS each 1024 reads */
                _rcu_read_unlock();
                nr_reads++;
                /* QS each 1024 reads */
@@ -233,7 +239,7 @@ void show_usage(int argc, char **argv)
        printf(" [-r] [-w] (yield reader and/or writer)");
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-r] [-w] (yield reader and/or writer)");
 #endif
        printf(" [-d delay] (writer period (us))");
-       printf(" [-c duration] (reader C.S. duration (us))");
+       printf(" [-c duration] (reader C.S. duration (in loops))");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
 }
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
 }
This page took 0.025781 seconds and 4 git commands to generate.