Print reader duration
[urcu.git] / test_qsbr.c
index 7ff1aca9c7600994f5b2ad30d79d0ca7fd3a0e60..35294430eb8665b0f607cbab90f3f3681fcfb4bb 100644 (file)
@@ -65,9 +65,15 @@ static struct test_array *test_rcu_pointer;
 
 static unsigned long duration;
 
-/* read-side C.S. duration, in us */
+/* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+static inline void loop_sleep(unsigned long l)
+{
+       while(l-- != 0)
+               cpu_relax();
+}
+
 /*
  * 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))
-                       usleep(rduration);
+                       loop_sleep(rduration);
                _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(" [-c duration] (reader C.S. duration (us))");
+       printf(" [-c duration] (reader C.S. duration (in loops))");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
 }
@@ -317,6 +323,7 @@ int main(int argc, char **argv)
        printf("running test for %lu seconds, %u readers, %u writers.\n",
                duration, nr_readers, nr_writers);
        printf("Writer delay : %u us.\n", wdelay);
+       printf("Reader duration : %lu loops.\n", rduration);
        printf("thread %-6s, thread id : %lx, tid %lu\n",
                        "main", pthread_self(), (unsigned long)gettid());
 
This page took 0.023376 seconds and 4 git commands to generate.