urcu tests: add writer duration parameter
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sun, 14 Feb 2010 13:43:05 +0000 (08:43 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sun, 14 Feb 2010 13:43:05 +0000 (08:43 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/runtests.sh
tests/test_mutex.c
tests/test_perthreadlock.c
tests/test_qsbr.c
tests/test_qsbr_gc.c
tests/test_rwlock.c
tests/test_urcu.c
tests/test_urcu_assign.c
tests/test_urcu_bp.c
tests/test_urcu_defer.c
tests/test_urcu_gc.c

index 981aef15fe25545b09dc3d74849703e8c60e539a..4b5f745b01a1e294be83a2bf3fa9e04a9df37589 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-for a in test_urcu_gc test_urcu_gc_mb test_urcu test_urcu_mb \
-                       test_urcu_lgc test_qsbr_lgc test_urcu_lgc_mb \
-                       test_qsbr test_qsbr_gc test_rwlock test_perthreadlock \
-                       test_mutex; do
+for a in test_urcu_gc test_urcu_signal_gc test_urcu_mb_gc test_qsbr_gc \
+       test_urcu_lgc test_urcu_signal_lgc test_urcu_mb_lgc test_qsbr_lgc \
+       test_urcu test_urcu_signal test_urcu_mb test_qsbr \
+       test_rwlock test_perthreadlock test_mutex; do
        echo "./${a} $*" | tee -a runall.detail.log
        /usr/bin/time --append --output runall.detail.log ./${a} $*
 done
index 7fb036d1632361f780b6c6281e1704af5cb28605..f3139cc3301dc46e0865c333f1926a860038380c 100644 (file)
@@ -79,6 +79,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -232,6 +235,8 @@ void *thr_writer(void *data)
                pthread_mutex_lock(&lock);
                test_array.a = 0;
                test_array.a = 8;
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                pthread_mutex_unlock(&lock);
                nr_writes++;
                if (unlikely(!test_duration_write()))
@@ -254,6 +259,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -328,6 +334,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index e47315b555f29392cf35bbcb92c36f36bf1cf676..7fcf3e801e228bdc21d4275e3ea92839bf04269b 100644 (file)
@@ -83,6 +83,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -239,6 +242,8 @@ void *thr_writer(void *data)
                }
                test_array.a = 0;
                test_array.a = 8;
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                for (tidx = (long)nr_readers - 1; tidx >= 0; tidx--) {
                        pthread_mutex_unlock(&per_thread_lock[tidx].lock);
                }
@@ -263,6 +268,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -337,6 +343,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index 7a68ae836af6a1d7e045da7c476f6d7f6e807cb2..7c78b798818deda1283c1d47c0b69c88af31b1a7 100644 (file)
@@ -77,6 +77,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -274,6 +277,8 @@ void *thr_writer(void *_count)
                new = test_array_alloc();
                new->a = 8;
                old = rcu_xchg_pointer(&test_rcu_pointer, new);
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                synchronize_rcu();
                /* can be done after unlock */
                if (old)
@@ -300,6 +305,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -373,6 +379,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index c480461b9156092ce0b9329d5fb1d8f04580aec6..dd7a5c432d45b647c035ba99a13456a2e1de0a4d 100644 (file)
@@ -82,6 +82,9 @@ struct reclaim_queue {
 static struct reclaim_queue *pending_reclaims;
 
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -284,6 +287,8 @@ void *thr_writer(void *data)
                new->a = 8;
                old = _rcu_xchg_pointer(&test_rcu_pointer, new);
 #endif
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                rcu_gc_reclaim(wtidx, old);
                nr_writes++;
                if (unlikely(!test_duration_write()))
@@ -304,8 +309,10 @@ void show_usage(int argc, char **argv)
 #ifdef DEBUG_YIELD
        printf(" [-r] [-w] (yield reader and/or writer)");
 #endif
+       printf(" [-b batch] (batch reclaim)");
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -386,6 +393,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index b8931008bfd6dd172b53f7f2dbde0ef8d683d885..4629a44b5b2e87c601b157150c769ca8918857e6 100644 (file)
@@ -79,6 +79,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -228,6 +231,8 @@ void *thr_writer(void *_count)
                pthread_rwlock_wrlock(&lock);
                test_array.a = 0;
                test_array.a = 8;
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                pthread_rwlock_unlock(&lock);
                nr_writes++;
                if (unlikely(!test_duration_write()))
@@ -250,6 +255,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -324,6 +330,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index 0cde0b3c992aa039500546934cd8c2be63677720..1ea9d07945d1741ab2dd58db57c454950b113cd4 100644 (file)
@@ -77,6 +77,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -272,6 +275,8 @@ void *thr_writer(void *_count)
                new = test_array_alloc();
                new->a = 8;
                old = rcu_xchg_pointer(&test_rcu_pointer, new);
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                synchronize_rcu();
                if (old)
                        old->a = 0;
@@ -297,6 +302,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -370,6 +376,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index d38361f313d3c43ab5a0c1250b21cc53fc9c4bc3..663a4e87258ad91774e5cf7dfcbf386eb33d5e7a 100644 (file)
@@ -77,6 +77,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -274,6 +277,8 @@ void *thr_writer(void *_count)
                rcu_copy_mutex_lock();
                old = test_rcu_pointer;
                rcu_assign_pointer(test_rcu_pointer, new);
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                rcu_copy_mutex_unlock();
                synchronize_rcu();
                if (old)
@@ -300,6 +305,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -373,6 +379,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index 5ba6e49ddf24ae007328c9ca9f08e1bcfcd7155f..d5653b05882e75a59cbfcf3e17a086afed802dda 100644 (file)
@@ -77,6 +77,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -272,6 +275,8 @@ void *thr_writer(void *_count)
                new = test_array_alloc();
                new->a = 8;
                old = rcu_xchg_pointer(&test_rcu_pointer, new);
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                synchronize_rcu();
                if (old)
                        old->a = 0;
@@ -297,6 +302,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -370,6 +376,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index 10cd250d2c9a3487f02c58f0e5135201ee3dbeda..59a0785393445b63c560d2eef47360194569ac8e 100644 (file)
@@ -78,6 +78,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -250,6 +253,8 @@ void *thr_writer(void *data)
                new = malloc(sizeof(*new));
                new->a = 8;
                old = rcu_xchg_pointer(&test_rcu_pointer, new);
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                defer_rcu(free, old);
                defer_rcu(test_cb1, old);
                defer_rcu(test_cb1, (void *)-2L);
@@ -281,6 +286,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -354,6 +360,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
index 4e6f965a84082c1ec5da7ea3dddda2383b1aa489..c7b2bdab1a885649c8c99ae67abd7e81802b62ff 100644 (file)
@@ -86,6 +86,9 @@ static unsigned long duration;
 /* read-side C.S. duration, in loops */
 static unsigned long rduration;
 
+/* write-side C.S. duration, in loops */
+static unsigned long wduration;
+
 static inline void loop_sleep(unsigned long l)
 {
        while(l-- != 0)
@@ -285,6 +288,8 @@ void *thr_writer(void *data)
                new->a = 8;
                old = rcu_xchg_pointer(&test_rcu_pointer, new);
 #endif
+               if (unlikely(wduration))
+                       loop_sleep(wduration);
                rcu_gc_reclaim(wtidx, old);
                nr_writes++;
                if (unlikely(!test_duration_write()))
@@ -307,6 +312,7 @@ void show_usage(int argc, char **argv)
 #endif
        printf(" [-d delay] (writer period (us))");
        printf(" [-c duration] (reader C.S. duration (in loops))");
+       printf(" [-e duration] (writer C.S. duration (in loops))");
        printf(" [-v] (verbose output)");
        printf(" [-a cpu#] [-a cpu#]... (affinity)");
        printf("\n");
@@ -387,6 +393,13 @@ int main(int argc, char **argv)
                        }
                        wdelay = atol(argv[++i]);
                        break;
+               case 'e':
+                       if (argc < i + 2) {
+                               show_usage(argc, argv);
+                               return -1;
+                       }
+                       wduration = atol(argv[++i]);
+                       break;
                case 'v':
                        verbose_mode = 1;
                        break;
This page took 0.03289 seconds and 4 git commands to generate.