printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
- tot_nr_reads = malloc(sizeof(*tot_nr_reads) * nr_readers);
- tot_nr_writes = malloc(sizeof(*tot_nr_writes) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
+ tot_nr_reads = calloc(nr_readers, sizeof(*tot_nr_reads));
+ tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- tot_nr_reads = malloc(sizeof(*tot_nr_reads) * nr_readers);
- tot_nr_writes = malloc(sizeof(*tot_nr_writes) * nr_writers);
- per_thread_lock = malloc(sizeof(*per_thread_lock) * nr_readers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ tot_nr_reads = calloc(nr_readers, sizeof(*tot_nr_reads));
+ tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
+ per_thread_lock = calloc(nr_readers, sizeof(*per_thread_lock));
for (i = 0; i < nr_readers; i++) {
err = pthread_mutex_init(&per_thread_lock[i].lock, NULL);
if (err != 0)
num_read = atoi(argv[1]);
num_write = atoi(argv[2]);
- reader_time = malloc(sizeof(*reader_time) * num_read);
- writer_time = malloc(sizeof(*writer_time) * num_write);
- tid_reader = malloc(sizeof(*tid_reader) * num_read);
- tid_writer = malloc(sizeof(*tid_writer) * num_write);
+ reader_time = calloc(num_read, sizeof(*reader_time));
+ writer_time = calloc(num_write, sizeof(*writer_time));
+ tid_reader = calloc(num_read, sizeof(*tid_reader));
+ tid_writer = calloc(num_write, sizeof(*tid_writer));
printf("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
next_aff = 0;
num_read = atoi(argv[1]);
num_write = atoi(argv[2]);
- reader_time = malloc(sizeof(*reader_time) * num_read);
- writer_time = malloc(sizeof(*writer_time) * num_write);
- tid_reader = malloc(sizeof(*tid_reader) * num_read);
- tid_writer = malloc(sizeof(*tid_writer) * num_write);
+ reader_time = calloc(num_read, sizeof(*reader_time));
+ writer_time = calloc(num_write, sizeof(*writer_time));
+ tid_reader = calloc(num_read, sizeof(*tid_reader));
+ tid_writer = calloc(num_write, sizeof(*tid_writer));
printf("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
next_aff = 0;
"main", urcu_get_thread_id());
test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE);
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- tot_nr_writes = malloc(sizeof(*tot_nr_writes) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- tot_nr_writes = malloc(sizeof(*tot_nr_writes) * nr_writers);
- pending_reclaims = malloc(sizeof(*pending_reclaims) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
+ pending_reclaims = calloc(nr_writers, sizeof(*pending_reclaims));
if (reclaim_batch * sizeof(*pending_reclaims[i].queue)
< CAA_CACHE_LINE_SIZE)
for (i = 0; i < nr_writers; i++)
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
if (!tid_reader) {
mainret = 1;
goto end;
}
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
if (!tid_writer) {
mainret = 1;
goto end_free_tid_reader;
}
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
if (!count_reader) {
mainret = 1;
goto end_free_tid_writer;
}
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
if (!count_writer) {
mainret = 1;
goto end_free_count_reader;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
- tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
- count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
- count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
+ tid_enqueuer = calloc(nr_enqueuers, sizeof(*tid_enqueuer));
+ tid_dequeuer = calloc(nr_dequeuers, sizeof(*tid_dequeuer));
+ count_enqueuer = calloc(nr_enqueuers, 2 * sizeof(*count_enqueuer));
+ count_dequeuer = calloc(nr_dequeuers, 2 * sizeof(*count_dequeuer));
cds_lfq_init_rcu(&q, call_rcu);
err = create_all_cpu_call_rcu_data(0);
if (err) {
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
- tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
- count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
- count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
+ tid_enqueuer = calloc(nr_enqueuers, sizeof(*tid_enqueuer));
+ tid_dequeuer = calloc(nr_dequeuers, sizeof(*tid_dequeuer));
+ count_enqueuer = calloc(nr_enqueuers, 2 * sizeof(*count_enqueuer));
+ count_dequeuer = calloc(nr_dequeuers, 2 * sizeof(*count_dequeuer));
cds_lfs_init(&s);
err = create_all_cpu_call_rcu_data(0);
if (err) {
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
- tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
- count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
- count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
+ tid_enqueuer = calloc(nr_enqueuers, sizeof(*tid_enqueuer));
+ tid_dequeuer = calloc(nr_dequeuers, sizeof(*tid_dequeuer));
+ count_enqueuer = calloc(nr_enqueuers, 2 * sizeof(*count_enqueuer));
+ count_dequeuer = calloc(nr_dequeuers, 2 * sizeof(*count_dequeuer));
cds_lfs_init_rcu(&s);
err = create_all_cpu_call_rcu_data(0);
if (err) {
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- count_writer = malloc(sizeof(*count_writer) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ count_writer = calloc(nr_writers, sizeof(*count_writer));
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
- tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
- count_reader = malloc(sizeof(*count_reader) * nr_readers);
- tot_nr_writes = malloc(sizeof(*tot_nr_writes) * nr_writers);
- pending_reclaims = malloc(sizeof(*pending_reclaims) * nr_writers);
+ tid_reader = calloc(nr_readers, sizeof(*tid_reader));
+ tid_writer = calloc(nr_writers, sizeof(*tid_writer));
+ count_reader = calloc(nr_readers, sizeof(*count_reader));
+ tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
+ pending_reclaims = calloc(nr_writers, sizeof(*pending_reclaims));
if (reclaim_batch * sizeof(*pending_reclaims[i].queue)
< CAA_CACHE_LINE_SIZE)
for (i = 0; i < nr_writers; i++)
num_read = atoi(argv[1]);
num_write = atoi(argv[2]);
- reader_time = malloc(sizeof(*reader_time) * num_read);
- writer_time = malloc(sizeof(*writer_time) * num_write);
- tid_reader = malloc(sizeof(*tid_reader) * num_read);
- tid_writer = malloc(sizeof(*tid_writer) * num_write);
+ reader_time = calloc(num_read, sizeof(*reader_time));
+ writer_time = calloc(num_write, sizeof(*writer_time));
+ tid_reader = calloc(num_read, sizeof(*tid_reader));
+ tid_writer = calloc(num_write, sizeof(*tid_writer));
printf("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
num_read = atoi(argv[1]);
num_write = atoi(argv[2]);
- reader_time = malloc(sizeof(*reader_time) * num_read);
- writer_time = malloc(sizeof(*writer_time) * num_write);
- tid_reader = malloc(sizeof(*tid_reader) * num_read);
- tid_writer = malloc(sizeof(*tid_writer) * num_write);
+ reader_time = calloc(num_read, sizeof(*reader_time));
+ writer_time = calloc(num_write, sizeof(*writer_time));
+ tid_reader = calloc(num_read, sizeof(*tid_reader));
+ tid_writer = calloc(num_write, sizeof(*tid_writer));
printf("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
- tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
- count_enqueuer = malloc(3 * sizeof(*count_enqueuer) * nr_enqueuers);
- count_dequeuer = malloc(4 * sizeof(*count_dequeuer) * nr_dequeuers);
+ tid_enqueuer = calloc(nr_enqueuers, sizeof(*tid_enqueuer));
+ tid_dequeuer = calloc(nr_dequeuers, sizeof(*tid_dequeuer));
+ count_enqueuer = calloc(nr_enqueuers, 3 * sizeof(*count_enqueuer));
+ count_dequeuer = calloc(nr_dequeuers, 4 * sizeof(*count_dequeuer));
cds_wfcq_init(&head, &tail);
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
- tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
- count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
- count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
+ tid_enqueuer = calloc(nr_enqueuers, sizeof(*tid_enqueuer));
+ tid_dequeuer = calloc(nr_dequeuers, sizeof(*tid_dequeuer));
+ count_enqueuer = calloc(nr_enqueuers, 2 * sizeof(*count_enqueuer));
+ count_dequeuer = calloc(nr_dequeuers, 2 * sizeof(*count_dequeuer));
cds_wfq_init(&q);
next_aff = 0;
printf_verbose("thread %-6s, tid %lu\n",
"main", urcu_get_thread_id());
- tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
- tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
- count_enqueuer = malloc(3 * sizeof(*count_enqueuer) * nr_enqueuers);
- count_dequeuer = malloc(4 * sizeof(*count_dequeuer) * nr_dequeuers);
+ tid_enqueuer = calloc(nr_enqueuers, sizeof(*tid_enqueuer));
+ tid_dequeuer = calloc(nr_dequeuers, sizeof(*tid_dequeuer));
+ count_enqueuer = calloc(nr_enqueuers, 3 * sizeof(*count_enqueuer));
+ count_dequeuer = calloc(nr_dequeuers, 4 * sizeof(*count_dequeuer));
cds_wfs_init(&s);
next_aff = 0;