#if SCHED_SETAFFINITY_ARGS == 2
sched_setaffinity(0, &mask);
#else
#if SCHED_SETAFFINITY_ARGS == 2
sched_setaffinity(0, &mask);
#else
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "counter", pthread_self(), (unsigned long)gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "counter", urcu_get_thread_id());
printf(" [-M size] Lookup pool size.\n");
printf(" [-N size] Write pool size.\n");
printf(" [-O size] Init pool size.\n");
printf(" [-M size] Lookup pool size.\n");
printf(" [-N size] Write pool size.\n");
printf(" [-O size] Init pool size.\n");
- printf(" [-V] Validate lookups of init values (use with filled init pool, same lookup range, with different write range).\n");
+ printf(" [-V] Validate lookups of init values.\n");
+ printf(" (use with filled init pool, same lookup range,\n");
+ printf(" with different write range)\n");
tot_add = 0, tot_add_exist = 0, tot_remove = 0;
unsigned long count;
long approx_before, approx_after;
tot_add = 0, tot_add_exist = 0, tot_remove = 0;
unsigned long count;
long approx_before, approx_after;
memory_backend = &cds_lfht_mm_chunk;
else if (!strcmp("mmap", argv[i]))
memory_backend = &cds_lfht_mm_mmap;
memory_backend = &cds_lfht_mm_chunk;
else if (!strcmp("mmap", argv[i]))
memory_backend = &cds_lfht_mm_mmap;
if (init_hash_size && init_hash_size & (init_hash_size - 1)) {
printf("Error: Initial number of buckets (%lu) is not a power of 2.\n",
init_hash_size);
if (init_hash_size && init_hash_size & (init_hash_size - 1)) {
printf("Error: Initial number of buckets (%lu) is not a power of 2.\n",
init_hash_size);
}
if (min_hash_alloc_size && min_hash_alloc_size & (min_hash_alloc_size - 1)) {
printf("Error: Minimum number of allocated buckets (%lu) is not a power of 2.\n",
min_hash_alloc_size);
}
if (min_hash_alloc_size && min_hash_alloc_size & (min_hash_alloc_size - 1)) {
printf("Error: Minimum number of allocated buckets (%lu) is not a power of 2.\n",
min_hash_alloc_size);
}
if (max_hash_buckets_size && max_hash_buckets_size & (max_hash_buckets_size - 1)) {
printf("Error: Maximum number of buckets (%lu) is not a power of 2.\n",
max_hash_buckets_size);
}
if (max_hash_buckets_size && max_hash_buckets_size & (max_hash_buckets_size - 1)) {
printf("Error: Maximum number of buckets (%lu) is not a power of 2.\n",
max_hash_buckets_size);
}
memset(&act, 0, sizeof(act));
ret = sigemptyset(&act.sa_mask);
if (ret == -1) {
perror("sigemptyset");
}
memset(&act, 0, sizeof(act));
ret = sigemptyset(&act.sa_mask);
if (ret == -1) {
perror("sigemptyset");
}
act.sa_handler = get_sigusr1_cb();
act.sa_flags = SA_RESTART;
ret = sigaction(SIGUSR1, &act, NULL);
if (ret == -1) {
perror("sigaction");
}
act.sa_handler = get_sigusr1_cb();
act.sa_flags = SA_RESTART;
ret = sigaction(SIGUSR1, &act, NULL);
if (ret == -1) {
perror("sigaction");
act.sa_handler = get_sigusr2_cb();
act.sa_flags = SA_RESTART;
ret = sigaction(SIGUSR2, &act, NULL);
if (ret == -1) {
perror("sigaction");
act.sa_handler = get_sigusr2_cb();
act.sa_flags = SA_RESTART;
ret = sigaction(SIGUSR2, &act, NULL);
if (ret == -1) {
perror("sigaction");
}
printf_verbose("running test for %lu seconds, %u readers, %u writers.\n",
}
printf_verbose("running test for %lu seconds, %u readers, %u writers.\n",
write_pool_offset, write_pool_size);
printf_verbose("Number of hash chains: %lu.\n",
nr_hash_chains);
write_pool_offset, write_pool_size);
printf_verbose("Number of hash chains: %lu.\n",
nr_hash_chains);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", pthread_self(), (unsigned long)gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
+ ret = pipe(count_pipe);
+ if (ret == -1) {
+ perror("pipe");
+ mainret = 1;
+ goto end_online;
+ }
+
+ /* spawn counter thread */
+ err = pthread_create(&tid_count, NULL, thr_count,
+ NULL);
+ if (err != 0) {
+ errno = err;
+ mainret = 1;
+ perror("pthread_create");
+ goto end_close_pipe;
+ }
+
for (i = 0; i < nr_readers; i++) {
err = pthread_create(&tid_reader[i],
NULL, get_thr_reader_cb(),
&count_reader[i]);
for (i = 0; i < nr_readers; i++) {
err = pthread_create(&tid_reader[i],
NULL, get_thr_reader_cb(),
&count_reader[i]);
}
for (i = 0; i < nr_writers; i++) {
err = pthread_create(&tid_writer[i],
NULL, get_thr_writer_cb(),
&count_writer[i]);
}
for (i = 0; i < nr_writers; i++) {
err = pthread_create(&tid_writer[i],
NULL, get_thr_writer_cb(),
&count_writer[i]);
tot_writes += count_writer[i].update_ops;
tot_add += count_writer[i].add;
tot_add_exist += count_writer[i].add_exist;
tot_writes += count_writer[i].update_ops;
tot_add += count_writer[i].add;
tot_add_exist += count_writer[i].add_exist;
act.sa_flags = SA_RESTART;
ret = sigaction(SIGUSR2, &act, NULL);
if (ret == -1) {
act.sa_flags = SA_RESTART;
ret = sigaction(SIGUSR2, &act, NULL);
if (ret == -1) {
} while (ret == -1L && errno == EINTR);
}
err = pthread_join(tid_count, &tret);
} while (ret == -1L && errno == EINTR);
}
err = pthread_join(tid_count, &tret);
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu "
"nr_writers %3u "
"wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu "
printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu "
"nr_writers %3u "
"wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu "
argv[0], duration, nr_readers, rduration,
nr_writers, wdelay, tot_reads, tot_writes,
tot_reads + tot_writes, tot_add, tot_add_exist, tot_remove,
argv[0], duration, nr_readers, rduration,
nr_writers, wdelay, tot_reads, tot_writes,
tot_reads + tot_writes, tot_add, tot_add_exist, tot_remove,