diff options
Diffstat (limited to 'storage/tokudb/PerconaFT/util/tests')
10 files changed, 64 insertions, 45 deletions
diff --git a/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc b/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc index bce1b1a885b..7e60c711c66 100644 --- a/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc +++ b/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc @@ -156,7 +156,7 @@ int int_heaviside(const uint32_t &v, const uint32_t &target) { struct stress_shared { stress_omt *omt; volatile bool running; - struct rwlock lock; + struct st_rwlock lock; toku_mutex_t mutex; int num_marker_threads; }; @@ -400,8 +400,8 @@ static void stress_test(int nelts) { struct stress_shared extra; ZERO_STRUCT(extra); extra.omt = &omt; - toku_mutex_init(&extra.mutex, NULL); - rwlock_init(&extra.lock); + toku_mutex_init(toku_uninstrumented, &extra.mutex, nullptr); + rwlock_init(toku_uninstrumented, &extra.lock); extra.running = true; extra.num_marker_threads = num_marker_threads; @@ -422,11 +422,19 @@ static void stress_test(int nelts) { r = myinitstate_r(seed, reader.buf_write, 8, &reader.rand_write); invariant_zero(r); - toku_pthread_create(&marker_threads[i], NULL, stress_mark_worker, &reader); + toku_pthread_create(toku_uninstrumented, + &marker_threads[i], + nullptr, + stress_mark_worker, + &reader); } toku_pthread_t deleter_thread; - toku_pthread_create(&deleter_thread, NULL, stress_delete_worker, &readers[0]); + toku_pthread_create(toku_uninstrumented, + &deleter_thread, + nullptr, + stress_delete_worker, + &readers[0]); toku_pthread_join(deleter_thread, NULL); for (int i = 0; i < num_marker_threads; ++i) { diff --git a/storage/tokudb/PerconaFT/util/tests/minicron-test.cc b/storage/tokudb/PerconaFT/util/tests/minicron-test.cc index a2ddbdeabdf..026ab7446d3 100644 --- a/storage/tokudb/PerconaFT/util/tests/minicron-test.cc +++ b/storage/tokudb/PerconaFT/util/tests/minicron-test.cc @@ -206,11 +206,12 @@ test_main (int argc, const char *argv[]) { toku_pthread_t tests[N]; unsigned int i; - for (i=0; i<N; i++) { - int r=toku_pthread_create(tests+i, 0, testfuns[i], 0); - assert(r==0); + for (i = 0; i < N; i++) { + int r = toku_pthread_create( + toku_uninstrumented, tests + i, nullptr, testfuns[i], nullptr); + assert(r == 0); } - for (i=0; i<N; i++) { + for (i = 0; i < N; i++) { void *v; int r=toku_pthread_join(tests[i], &v); assert(r==0); diff --git a/storage/tokudb/PerconaFT/util/tests/queue-test.cc b/storage/tokudb/PerconaFT/util/tests/queue-test.cc index 433a0aca32a..f87e05bc664 100644 --- a/storage/tokudb/PerconaFT/util/tests/queue-test.cc +++ b/storage/tokudb/PerconaFT/util/tests/queue-test.cc @@ -87,9 +87,11 @@ static void queue_test_0 (uint64_t weight) d_max_weight = 0; QUEUE q; int r; - r = toku_queue_create(&q, weight); assert(r==0); + r = toku_queue_create(&q, weight); + assert(r == 0); toku_pthread_t thread; - r = toku_pthread_create(&thread, NULL, start_0, q); assert(r==0); + r = toku_pthread_create(toku_uninstrumented, &thread, nullptr, start_0, q); + assert(r == 0); enq(q, 0L, weight); enq(q, 1L, weight); enq(q, 2L, weight); diff --git a/storage/tokudb/PerconaFT/util/tests/rwlock_condvar.h b/storage/tokudb/PerconaFT/util/tests/rwlock_condvar.h index 816b98af81c..b49c2780ff8 100644 --- a/storage/tokudb/PerconaFT/util/tests/rwlock_condvar.h +++ b/storage/tokudb/PerconaFT/util/tests/rwlock_condvar.h @@ -67,13 +67,13 @@ struct toku_cv_fair_rwlock_waiter_state { static __thread struct toku_cv_fair_rwlock_waiter_state waitstate = {0, NULL, {PTHREAD_COND_INITIALIZER} }; void toku_cv_fair_rwlock_init (toku_cv_fair_rwlock_t *rwlock) { - rwlock->state=0; + rwlock->state = 0; rwlock->waiters_head = NULL; rwlock->waiters_tail = NULL; - toku_mutex_init(&rwlock->mutex, NULL); + toku_mutex_init(toku_uninstrumented, &rwlock->mutex, nullptr); } -void toku_cv_fair_rwlock_destroy (toku_cv_fair_rwlock_t *rwlock) { +void toku_cv_fair_rwlock_destroy(toku_cv_fair_rwlock_t *rwlock) { toku_mutex_destroy(&rwlock->mutex); } diff --git a/storage/tokudb/PerconaFT/util/tests/sm-basic.cc b/storage/tokudb/PerconaFT/util/tests/sm-basic.cc index 80bc965fd31..0e5eb8364e2 100644 --- a/storage/tokudb/PerconaFT/util/tests/sm-basic.cc +++ b/storage/tokudb/PerconaFT/util/tests/sm-basic.cc @@ -64,7 +64,8 @@ int main(void) { // run the test toku_pthread_t tid; int r; - r = toku_pthread_create(&tid, NULL, sm_test_f, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, sm_test_f, nullptr); assert_zero(r); void *ret; r = toku_pthread_join(tid, &ret); diff --git a/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc b/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc index c5d7e3e53a7..5aa3565510b 100644 --- a/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc +++ b/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc @@ -64,10 +64,12 @@ int main(void) { toku_scoped_malloc_init(); toku_pthread_t tid; int r; - r = toku_pthread_create(&tid, NULL, sm_test_f, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, sm_test_f, nullptr); assert_zero(r); void *ret; - while (state != 1) sleep(1); + while (state != 1) + sleep(1); toku_scoped_malloc_destroy_set(); state = 2; r = toku_pthread_join(tid, &ret); diff --git a/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc b/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc index 7fd4801fe11..9a625c32aeb 100644 --- a/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc +++ b/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc @@ -66,9 +66,9 @@ static void *t1_func(void *arg) { int main(void) { int r; - toku_mutex_init(&rwlock_mutex, NULL); + toku_mutex_init(toku_uninstrumented, &rwlock_mutex, nullptr); rwlock.init(&rwlock_mutex); - + const int nthreads = 2; pthread_t tids[nthreads]; for (int i = 0; i < nthreads; i++) { diff --git a/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc b/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc index 0075ddf9bcb..c0b43c2db1c 100644 --- a/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc +++ b/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc @@ -101,7 +101,8 @@ static void *do_read_wait(void *arg) { static void launch_cheap_waiter(void) { toku_pthread_t tid; - int r = toku_pthread_create(&tid, NULL, do_cheap_wait, NULL); + int r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, do_cheap_wait, nullptr); assert_zero(r); toku_pthread_detach(tid); sleep(1); @@ -109,7 +110,8 @@ static void launch_cheap_waiter(void) { static void launch_expensive_waiter(void) { toku_pthread_t tid; - int r = toku_pthread_create(&tid, NULL, do_expensive_wait, NULL); + int r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, do_expensive_wait, nullptr); assert_zero(r); toku_pthread_detach(tid); sleep(1); @@ -117,7 +119,8 @@ static void launch_expensive_waiter(void) { static void launch_reader(void) { toku_pthread_t tid; - int r = toku_pthread_create(&tid, NULL, do_read_wait, NULL); + int r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, do_read_wait, nullptr); assert_zero(r); toku_pthread_detach(tid); sleep(1); @@ -132,7 +135,7 @@ static bool locks_are_expensive(void) { } static void test_write_cheapness(void) { - toku_mutex_init(&mutex, NULL); + toku_mutex_init(toku_uninstrumented, &mutex, nullptr); w.init(&mutex); // single expensive write lock diff --git a/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc b/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc index 18ca1229f56..56dd3f6b480 100644 --- a/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc +++ b/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc @@ -245,14 +245,14 @@ static void util_rwlock_unlock (RWLOCK rwlock, toku_mutex_t *mutex) { } // Time the read lock that's in util/rwlock.h -void time_util_rwlock (void) __attribute((__noinline__)); -void time_util_rwlock (void) { - struct rwlock rwlock; +void time_util_rwlock(void) __attribute((__noinline__)); +void time_util_rwlock(void) { + struct st_rwlock rwlock; toku_mutex_t external_mutex; - toku_mutex_init(&external_mutex, NULL); - rwlock_init(&rwlock); - struct timeval start,end; - + toku_mutex_init(toku_uninstrumented, &external_mutex, nullptr); + rwlock_init(toku_uninstrumented, &rwlock); + struct timeval start, end; + util_rwlock_lock(&rwlock, &external_mutex); util_rwlock_unlock(&rwlock, &external_mutex); for (int t=0; t<T; t++) { @@ -271,16 +271,17 @@ void time_util_rwlock (void) { toku_mutex_destroy(&external_mutex); } -// Time the read lock that's in util/rwlock.h, assuming the mutex is already held. -void time_util_prelocked_rwlock (void) __attribute__((__noinline__)); -void time_util_prelocked_rwlock (void) { - struct rwlock rwlock; +// Time the read lock that's in util/rwlock.h, assuming the mutex is already +// held. +void time_util_prelocked_rwlock(void) __attribute__((__noinline__)); +void time_util_prelocked_rwlock(void) { + struct st_rwlock rwlock; toku_mutex_t external_mutex; - toku_mutex_init(&external_mutex, NULL); + toku_mutex_init(toku_uninstrumented, &external_mutex, nullptr); toku_mutex_lock(&external_mutex); - rwlock_init(&rwlock); - struct timeval start,end; - + rwlock_init(toku_uninstrumented, &rwlock); + struct timeval start, end; + rwlock_read_lock(&rwlock, &external_mutex); rwlock_read_unlock(&rwlock); for (int t=0; t<T; t++) { @@ -303,8 +304,8 @@ void time_util_prelocked_rwlock (void) { void time_frwlock_prelocked(void) __attribute__((__noinline__)); void time_frwlock_prelocked(void) { toku_mutex_t external_mutex; - toku_mutex_init(&external_mutex, NULL); - struct timeval start,end; + toku_mutex_init(toku_uninstrumented, &external_mutex, nullptr); + struct timeval start, end; toku::frwlock x; x.init(&external_mutex); toku_mutex_lock(&external_mutex); @@ -340,8 +341,8 @@ void time_frwlock_prelocked(void) { void time_frwlock(void) __attribute__((__noinline__)); void time_frwlock(void) { toku_mutex_t external_mutex; - toku_mutex_init(&external_mutex, NULL); - struct timeval start,end; + toku_mutex_init(toku_uninstrumented, &external_mutex, nullptr); + struct timeval start, end; toku::frwlock x; x.init(&external_mutex); toku_mutex_lock(&external_mutex); diff --git a/storage/tokudb/PerconaFT/util/tests/threadpool-test.cc b/storage/tokudb/PerconaFT/util/tests/threadpool-test.cc index 3379507270d..83c142edc2d 100644 --- a/storage/tokudb/PerconaFT/util/tests/threadpool-test.cc +++ b/storage/tokudb/PerconaFT/util/tests/threadpool-test.cc @@ -67,10 +67,11 @@ struct my_threadpool { static void my_threadpool_init (struct my_threadpool *my_threadpool, int max_threads) { int r; - r = toku_thread_pool_create(&my_threadpool->threadpool, max_threads); assert(r == 0); + r = toku_thread_pool_create(&my_threadpool->threadpool, max_threads); + assert(r == 0); assert(my_threadpool != 0); - toku_mutex_init(&my_threadpool->mutex, 0); - toku_cond_init(&my_threadpool->wait, 0); + toku_mutex_init(toku_uninstrumented, &my_threadpool->mutex, nullptr); + toku_cond_init(toku_uninstrumented, &my_threadpool->wait, nullptr); my_threadpool->closed = 0; my_threadpool->counter = 0; } |