X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_hash_unique.c;h=adbbde0db4f0c59ce751feec00cc4276763c57d3;hb=a5bae03d59c22e57263b8610b9fed99738303cf0;hp=89e294327b1596ae634ccee507831b79d6bc7fcd;hpb=1de4df4b770e5e90440008becc5e14a15c75c6e0;p=urcu.git diff --git a/tests/test_urcu_hash_unique.c b/tests/test_urcu_hash_unique.c index 89e2943..adbbde0 100644 --- a/tests/test_urcu_hash_unique.c +++ b/tests/test_urcu_hash_unique.c @@ -63,8 +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", 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(); @@ -108,10 +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", pthread_self(), (unsigned long)gettid()); - printf_verbose("readid : %lx, lookupfail %lu, lookupok %lu\n", - 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); @@ -126,8 +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", 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(); @@ -220,11 +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", pthread_self(), (unsigned long)gettid()); - printf_verbose("info id %lx: nr_add %lu, nr_addexist %lu, nr_del %lu, " - "nr_delnoent %lu\n", 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); @@ -240,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;