Add -c option for read-side C.S. length to tests
[urcu.git] / test_qsbr.c
index f56234b564c8bac4a6d01ff1b2eede53beba3e0f..7ff1aca9c7600994f5b2ad30d79d0ca7fd3a0e60 100644 (file)
@@ -65,6 +65,9 @@ static struct test_array *test_rcu_pointer;
 
 static unsigned long duration;
 
+/* read-side C.S. duration, in us */
+static unsigned long rduration;
+
 /*
  * returns 0 if test should end.
  */
@@ -164,6 +167,8 @@ void *thr_reader(void *_count)
                debug_yield_read();
                if (local_ptr)
                        assert(local_ptr->a == 8);
+               if (unlikely(rduration))
+                       usleep(rduration);
                _rcu_read_unlock();
                nr_reads++;
                /* QS each 1024 reads */
@@ -228,6 +233,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(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
 }
@@ -291,6 +297,13 @@ int main(int argc, char **argv)
                        use_affinity = 1;
                        printf("Adding CPU %d affinity\n", a);
                        break;
+               case 'c':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       rduration = atoi(argv[++i]);
+                       break;
                case 'd':
                        if (argc < i + 2) {
                                show_usage(argc, argv);
This page took 0.022963 seconds and 4 git commands to generate.