Unlikely for tests
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 10 Jun 2009 18:59:13 +0000 (14:59 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 10 Jun 2009 18:59:13 +0000 (14:59 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
test_perthreadlock.c
test_qsbr.c
test_rwlock.c
test_urcu.c

index 7b6a65c8c6fb18a68531e13c19587e44aad6729c..3684975eebf7c85312cd3a6a2322f88af03c022c 100644 (file)
@@ -134,7 +134,7 @@ void *thr_reader(void *data)
                assert(test_array.a == 8);
                pthread_mutex_unlock(&per_thread_lock[tidx].lock);
                nr_reads++;
-               if (!test_duration_read())
+               if (unlikely(!test_duration_read()))
                        break;
        }
 
@@ -168,9 +168,9 @@ void *thr_writer(void *data)
                        pthread_mutex_unlock(&per_thread_lock[tidx].lock);
                }
                nr_writes++;
-               if (!test_duration_write())
+               if (unlikely(!test_duration_write()))
                        break;
-               if (wdelay)
+               if (unlikely(wdelay))
                        usleep(wdelay);
        }
 
index ff55f8b8515f62185d1241056a1cfc8668bce010..82521efcf83a9babbf743f7741ad05a473efabb6 100644 (file)
@@ -165,9 +165,9 @@ void *thr_reader(void *_count)
                _rcu_read_unlock();
                nr_reads++;
                /* QS each 1024 reads */
-               if ((nr_reads & ((1 << 10) - 1)) == 0)
+               if (unlikely((nr_reads & ((1 << 10) - 1)) == 0))
                        _rcu_quiescent_state();
-               if (!test_duration_read())
+               if (unlikely(!test_duration_read()))
                        break;
        }
 
@@ -207,9 +207,9 @@ void *thr_writer(void *_count)
                        old->a = 0;
                test_array_free(old);
                nr_writes++;
-               if (!test_duration_write())
+               if (unlikely(!test_duration_write()))
                        break;
-               if (wdelay)
+               if (unlikely(wdelay))
                        usleep(wdelay);
        }
 
index ef3ce2c73bb49c14571703c9d9d6eb94e5ba164a..1c29d73839adaec693c53a2315c8e0cd8a2a1be0 100644 (file)
@@ -127,7 +127,7 @@ void *thr_reader(void *_count)
                assert(test_array.a == 8);
                pthread_rwlock_unlock(&lock);
                nr_reads++;
-               if (!test_duration_read())
+               if (unlikely(!test_duration_read()))
                        break;
        }
 
@@ -156,9 +156,9 @@ void *thr_writer(void *_count)
                test_array.a = 8;
                pthread_rwlock_unlock(&lock);
                nr_writes++;
-               if (!test_duration_write())
+               if (unlikely(!test_duration_write()))
                        break;
-               if (wdelay)
+               if (unlikely(wdelay))
                        usleep(wdelay);
        }
 
index d300610e049dc907147228e40d1c2b34245942b4..58612815f3c2bbd4882593edf549f935f152593e 100644 (file)
@@ -168,7 +168,7 @@ void *thr_reader(void *_count)
                        assert(local_ptr->a == 8);
                rcu_read_unlock();
                nr_reads++;
-               if (!test_duration_read())
+               if (unlikely(!test_duration_read()))
                        break;
        }
 
@@ -208,9 +208,9 @@ void *thr_writer(void *_count)
                        old->a = 0;
                test_array_free(old);
                nr_writes++;
-               if (!test_duration_write())
+               if (unlikely(!test_duration_write()))
                        break;
-               if (wdelay)
+               if (unlikely(wdelay))
                        usleep(wdelay);
        }
 
This page took 0.028131 seconds and 4 git commands to generate.