X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_hash_unique.c;h=adbbde0db4f0c59ce751feec00cc4276763c57d3;hb=98f483d24f69785a7fb2e988f1053c34e84a4e61;hp=331c9bd57cf8152e25c778aad04df00a34d39b49;hpb=a39bde3b86162601c7d670d97a962fc3f029fdbd;p=urcu.git diff --git a/tests/test_urcu_hash_unique.c b/tests/test_urcu_hash_unique.c index 331c9bd..adbbde0 100644 --- a/tests/test_urcu_hash_unique.c +++ b/tests/test_urcu_hash_unique.c @@ -63,9 +63,10 @@ void *test_hash_unique_thr_reader(void *_count) { unsigned long long *count = _count; - printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", - "reader", (unsigned long) pthread_self(), - (unsigned long) gettid()); + printf_verbose("thread_begin %s, tid %lu\n", + "reader", urcu_get_thread_id()); + + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); set_affinity(); @@ -109,11 +110,10 @@ void *test_hash_unique_thr_reader(void *_count) rcu_unregister_thread(); *count = URCU_TLS(nr_reads); - printf_verbose("thread_end %s, thread id : %lx, tid %lu\n", - "reader", (unsigned long) pthread_self(), - (unsigned long) gettid()); - printf_verbose("readid : %lx, lookupfail %lu, lookupok %lu\n", - (unsigned long) pthread_self(), URCU_TLS(lookup_fail), + printf_verbose("thread_end %s, tid %lu\n", + "reader", urcu_get_thread_id()); + printf_verbose("read tid : %lu, lookupfail %lu, lookupok %lu\n", + urcu_get_thread_id(), URCU_TLS(lookup_fail), URCU_TLS(lookup_ok)); return ((void*)1); @@ -128,9 +128,10 @@ void *test_hash_unique_thr_writer(void *_count) int ret; int loc_add_unique; - printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", - "writer", (unsigned long) pthread_self(), - (unsigned long) gettid()); + printf_verbose("thread_begin %s, tid %lu\n", + "writer", urcu_get_thread_id()); + + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); set_affinity(); @@ -223,12 +224,13 @@ void *test_hash_unique_thr_writer(void *_count) rcu_unregister_thread(); - printf_verbose("thread_end %s, thread id : %lx, tid %lu\n", - "writer", (unsigned long) pthread_self(), - (unsigned long) gettid()); - printf_verbose("info id %lx: nr_add %lu, nr_addexist %lu, nr_del %lu, " - "nr_delnoent %lu\n", (unsigned long) pthread_self(), URCU_TLS(nr_add), - URCU_TLS(nr_addexist), URCU_TLS(nr_del), + printf_verbose("thread_end %s, tid %lu\n", + "writer", urcu_get_thread_id()); + printf_verbose("info tid %lu: nr_add %lu, nr_addexist %lu, nr_del %lu, " + "nr_delnoent %lu\n", urcu_get_thread_id(), + URCU_TLS(nr_add), + URCU_TLS(nr_addexist), + URCU_TLS(nr_del), URCU_TLS(nr_delnoent)); count->update_ops = URCU_TLS(nr_writes); count->add = URCU_TLS(nr_add); @@ -244,6 +246,8 @@ int test_hash_unique_populate_hash(void) printf("Starting uniqueness test.\n"); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + if (!init_populate) return 0;