printf("Test ended with error: %d\n", ret);
}
return ret;
-
-#if 0
- /*
- * Hash Population needs to be seen as a RCU reader
- * thread from the point of view of resize.
- */
- rcu_register_thread();
- ret = (get_populate_hash_cb())();
- assert(!ret);
-
- rcu_thread_offline();
-
- /* teardown counter thread */
- act.sa_handler = SIG_IGN;
- act.sa_flags = SA_RESTART;
- ret = sigaction(SIGUSR2, &act, NULL);
- if (ret == -1) {
- perror("sigaction");
- return -1;
- }
- {
- char msg[1] = { 0x42 };
- ssize_t ret;
-
- do {
- ret = write(count_pipe[1], msg, 1); /* wakeup thread */
- } while (ret == -1L && errno == EINTR);
- }
-
- fflush(stdout);
- rcu_thread_online();
- rcu_read_lock();
- printf("Counting nodes... ");
- cds_lfht_count_nodes(test_ht, &approx_before, &count, &approx_after);
- printf("done.\n");
- test_delete_all_nodes(test_ht);
- rcu_read_unlock();
- rcu_thread_offline();
- if (count) {
- printf("Approximation before node accounting: %ld nodes.\n",
- approx_before);
- printf("Nodes deleted from hash table before destroy: "
- "%lu nodes.\n",
- count);
- printf("Approximation after node accounting: %ld nodes.\n",
- approx_after);
- }
- ret = cds_lfht_destroy(test_ht, NULL);
- if (ret)
- printf_verbose("final delete aborted\n");
- else
- printf_verbose("final delete success\n");
- 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 "
- "nr_add %12llu nr_add_fail %12llu nr_remove %12llu nr_leaked %12lld\n",
- argv[0], duration, nr_readers, rduration,
- nr_writers, wdelay, tot_reads, tot_writes,
- tot_reads + tot_writes, tot_add, tot_add_exist, tot_remove,
- (long long) tot_add + init_populate - tot_remove - count);
- rcu_unregister_thread();
-#endif
- return 0;
}