Cleanup: enable signed/unsigned compare compiler warning
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mathieu Desnoyers
AppliedMerged into master branch, thanks!
Mathieu
Quoted 1,814 lines · ----- On Dec 18, 2018, at 2:21 PM, Michael Jeanson [email protected] wrote:
Signed-off-by Michael Jeanson <[email protected]>---
configure.ac | 2 +- doc/examples/rculfhash/cds_lfht_add_replace.c | 2 +- doc/examples/rculfhash/cds_lfht_add_unique.c | 2 +- doc/examples/rculfhash/cds_lfht_del.c | 2 +- .../cds_lfht_for_each_entry_duplicate.c | 2 +- doc/examples/rculfhash/cds_lfht_lookup.c | 2 +- src/rculfhash.c | 27 ++++++---- src/urcu-utils.h | 14 +++++ tests/benchmark/test_mutex.c | 27 +++++----- tests/benchmark/test_perthreadlock.c | 31 +++++------ tests/benchmark/test_perthreadlock_timing.c | 4 +- tests/benchmark/test_rwlock.c | 25 ++++----- tests/benchmark/test_rwlock_timing.c | 6 ++- tests/benchmark/test_urcu.c | 29 +++++----- tests/benchmark/test_urcu_assign.c | 35 ++++++------ tests/benchmark/test_urcu_bp.c | 31 ++++++----- tests/benchmark/test_urcu_defer.c | 29 +++++----- tests/benchmark/test_urcu_gc.c | 54 ++++++++++--------- tests/benchmark/test_urcu_hash.c | 33 ++++++------ tests/benchmark/test_urcu_lfq.c | 36 +++++++------ tests/benchmark/test_urcu_lfs.c | 36 +++++++------ tests/benchmark/test_urcu_lfs_rcu.c | 35 ++++++------ tests/benchmark/test_urcu_qsbr.c | 29 +++++----- tests/benchmark/test_urcu_qsbr_gc.c | 53 +++++++++--------- tests/benchmark/test_urcu_qsbr_timing.c | 4 +- tests/benchmark/test_urcu_timing.c | 4 +- tests/benchmark/test_urcu_wfcq.c | 44 +++++++-------- tests/benchmark/test_urcu_wfq.c | 36 +++++++------ tests/benchmark/test_urcu_wfs.c | 43 ++++++++------- 29 files changed, 365 insertions(+), 312 deletions(-)configure.ac +0
-0@@ -381,7 +381,7 @@ AC_CHECK_FUNCS([sched_setaffinity],[AM_CPPFLAGS="-include
config.h"AC_SUBST(AM_CPPFLAGS)configure.ac +1
-1-AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $AM_CFLAGS" +AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter $AM_CFLAGS"
AC_SUBST(AM_CFLAGS)AC_CONFIG_LINKS([
doc/examples/rculfhash/cds_lfht_add_replace.c +1
-1@@ -41,7 +41,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key) {struct mynode *node = caa_container_of(ht_node, struct mynode, node); -const unsigned int *key = _key; +const int *key = _key;return *key == node->value; }doc/examples/rculfhash/cds_lfht_add_unique.c +1
-1@@ -38,7 +38,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key) {struct mynode *node = caa_container_of(ht_node, struct mynode, node); -const unsigned int *key = _key; +const int *key = _key;return *key == node->value; }doc/examples/rculfhash/cds_lfht_del.c +1
-1@@ -37,7 +37,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key) {struct mynode *node = caa_container_of(ht_node, struct mynode, node); -const unsigned int *key = _key; +const int *key = _key;return *key == node->value; }doc/examples/rculfhash/cds_lfht_for_each_entry_duplicate.c +1
-1@@ -37,7 +37,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key) {struct mynode *node = caa_container_of(ht_node, struct mynode, node); -const unsigned int *key = _key; +const int *key = _key;return *key == node->value; }doc/examples/rculfhash/cds_lfht_lookup.c +1
-1@@ -37,7 +37,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key) {struct mynode *node = caa_container_of(ht_node, struct mynode, node); -const unsigned int *key = _key; +const int *key = _key;return *key == node->value; }src/rculfhash.c +1
-0@@ -279,6 +279,7 @@#include <signal.h> #include "workqueue.h" #include "urcu-die.h" +#include "urcu-utils.h" /* * Split-counters lazily update the global counter each 1024 @@ -711,9 +712,8 @@ int ht_get_split_count_index(unsigned long hash)static
voidht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash){src/rculfhash.c +1
-1-unsigned long split_count; +unsigned long split_count, count;int index;src/rculfhash.c +0
-1-long count;if (caa_unlikely(!ht->split_count)) return;src/rculfhash.c +1
-1@@ -732,7 +732,7 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash)if ((count >>CHAIN_LEN_RESIZE_THRESHOLD ) < size)return ; -dbg_printf ("add set global %ld\n" , count); +dbg_printf ("add set global %lu\n" , count);cds_lfht_resize_lazy_count (ht, size, count >> (CHAIN_LEN_TARGET -1 ));}
src/rculfhash.c +0
-0@@ -740,9 +740,8 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash)static
voidht_count_del(struct cds_lfht *ht, unsigned long size, unsigned long hash){src/rculfhash.c +1
-1-unsigned long split_count; +unsigned long split_count, count;int index;src/rculfhash.c +0
-1-long count;if (caa_unlikely(!ht->split_count)) return;src/rculfhash.c +2
-2@@ -1247,8 +1246,8 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i, {unsigned long partition_len, start =0 ;struct partition_resize_work *work; -int thread, ret; -unsigned long nr_threads; +int ret; +unsigned long thread, nr_threads;assert (nr_cpus_mask !=-1 );if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)src/rculfhash.c +1
-1@@ -1260,7 +1259,7 @@ void partition_resize_helper(struct cds_lfht *ht, unsignedlong i, * partition size, up to the number of CPUs in the system. */ if (nr_cpus_mask >0 ) { - nr_threads =min (nr_cpus_mask +1 , + nr_threads = min_t(unsigned long, nr_cpus_mask + 1, len >>MIN_PARTITION_PER_THREAD_ORDER ); }else {nr_threads = 1;src/rculfhash.c +4
-2@@ -1449,8 +1448,7 @@ staticvoid fini_table (struct cds_lfht *ht,unsigned long first_order,unsigned long last_order) { -long i; -unsigned long free_by_rcu_order =0 ; +unsigned long free_by_rcu_order =0 , i;dbg_printf ("fini table: first_order %lu last_order %lu\n" , first_order, last_order);@@ -1499,11 +1497,15 @@ void fini_table(struct cds_lfht *ht, } } +/* +* Never called with size < 1. +*/ static
voidcds_lfht_create_bucket(struct cds_lfht *ht, unsigned long size){ struct cds_lfht_node *prev, *node; unsigned long order, len, i;src/rculfhash.c +1
-0+int bucket_order;cds_lfht_alloc_bucket_table(ht, 0);src/rculfhash.c +4
-1@@ -1512,7 +1514,10 @@ void cds_lfht_create_bucket(struct cds_lfht *ht, unsigned long size) node->next = flag_bucket(get_end()); node->reverse_hash =0 ; -for (order =1 ; order <cds_lfht_get_count_order_ulong (size) +1 ; order++) { + bucket_order =cds_lfht_get_count_order_ulong (size); +assert (bucket_order >=0 ); + +for (order =1 ; order < (unsigned long ) bucket_order +1 ; order++) { len =1UL << (order -1 );cds_lfht_alloc_bucket_table (ht, order);src/urcu-utils.h +14
-0@@ -26,6 +26,20 @@#define urcu_stringify (a) _urcu_stringify(a)#define _urcu_stringify (a) #a +#define max_t (type, x, y) \ + ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1: __max2; \ + }) + +#define min_t (type, x, y) \ + ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 <= __min2 ? __min1: __min2; \ + }) +/* There is no concept of symbol aliases on MacOS */ #ifdef __APPLE__#define URCU_ATTR_ALIAS (x)tests/benchmark/test_mutex.c +14
-13@@ -252,6 +252,7 @@ int main(int argc, char **argv)unsigned long long *count_reader, *count_writer;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -270,7 +271,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -334,15 +335,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + (void *)(long )i_thr);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + (void *)(long )i_thr);if (err !=0 )exit (1 ); }@@ -355,17 +356,17 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += tot_nr_reads[i]; + tot_reads += tot_nr_reads[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += tot_nr_writes[i]; + tot_writes += tot_nr_writes[i_thr]; } printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,tests/benchmark/test_perthreadlock.c +16
-15@@ -263,6 +263,7 @@ int main(int argc, char **argv)void *tret;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -281,7 +282,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -341,21 +342,21 @@ int main(int argc, char **argv) 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++) { -pthread_mutex_init (&per_thread_lock[i].lock,NULL ); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { +pthread_mutex_init (&per_thread_lock[i_thr].lock,NULL ); } next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + (void *)(long )i_thr);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + (void *)(long )i_thr);if (err !=0 )exit (1 ); }@@ -368,17 +369,17 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += tot_nr_reads[i]; + tot_reads += tot_nr_reads[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += tot_nr_writes[i]; + tot_writes += tot_nr_writes[i_thr]; } printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,tests/benchmark/test_perthreadlock_timing.c +2
-2@@ -69,7 +69,7 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;void *thr_reader (void *arg) { -int i, j; +unsigned int i, j;caa_cycles_t time1, time2;long tidx = (long )arg;@@ -98,7 +98,7 @@ void *thr_reader(void *arg)void *thr_writer (void *arg) { -int i, j; +unsigned int i, j;long tidx;caa_cycles_t time1, time2;tests/benchmark/test_rwlock.c +13
-12@@ -277,6 +277,7 @@ int main(int argc, char **argv)unsigned long long *count_reader, *count_writer;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -364,15 +365,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - &count_writer[i]); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + &count_writer[i_thr]);if (err !=0 )exit (1 ); }@@ -385,17 +386,17 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += count_writer[i]; + tot_writes += count_writer[i_thr]; } printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,tests/benchmark/test_rwlock_timing.c +2
-1@@ -69,7 +69,8 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;void *thr_reader (void *arg) { -int i, j, ret; +unsigned int i, j; +int ret;caa_cycles_t time1, time2;printf("thread_begin %s, tid %lu\n",
tests/benchmark/test_rwlock_timing.c +2
-1@@ -107,7 +108,8 @@ void *thr_reader(void *arg)void *thr_writer (void *arg) { -int i, j, ret; +unsigned int i, j; +int ret;caa_cycles_t time1, time2; printf("thread_begin %s, tid %lu\n",tests/benchmark/test_urcu.c +15
-14@@ -261,6 +261,7 @@ int main(int argc, char **argv)unsigned long long *count_reader, *count_writer;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -278,7 +279,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -346,15 +347,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - &count_writer[i]); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + &count_writer[i_thr]);if (err !=0 )exit (1 ); }@@ -367,19 +368,19 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += count_writer[i]; + tot_writes += count_writer[i_thr]; } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "tests/benchmark/test_urcu_assign.c +19
-16@@ -165,8 +165,8 @@ void rcu_copy_mutex_unlock(void)* both alloc and free, which insures we never run over our tail. */ #define ARRAY_SIZE (1048576 * nr_writers) -#define ARRAY_POISON 0xDEADBEEF -static int array_index; +#define ARRAY_POISON (int) 0xDEADBEEF +static unsigned int array_index;static struct test_array *test_array;static struct test_array *test_array_alloc (void )@@ -294,6 +294,7 @@ int main(int argc, char **argv)unsigned long long *count_reader, *count_writer;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -311,7 +312,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -380,15 +381,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - &count_writer[i]); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + &count_writer[i_thr]);if (err !=0 )exit (1 ); }@@ -401,19 +402,19 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += count_writer[i]; + tot_writes += count_writer[i_thr]; } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "@@ -422,11 +423,13 @@ int main(int argc, char **argv) argv[0 ], duration, nr_readers, rduration, wduration, nr_writers, wdelay, tot_reads, tot_writes, tot_reads + tot_writes); +test_array_free (test_rcu_pointer);free (test_array);free (tid_reader);free (tid_writer);free (count_reader);free (count_writer); +return 0 ; }tests/benchmark/test_urcu_bp.c +17
-14@@ -256,6 +256,7 @@ int main(int argc, char **argv)unsigned long long *count_reader, *count_writer;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -273,7 +274,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -341,15 +342,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - &count_writer[i]); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + &count_writer[i_thr]);if (err !=0 )exit (1 ); }@@ -362,19 +363,19 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += count_writer[i]; + tot_writes += count_writer[i_thr]; } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "@@ -383,10 +384,12 @@ int main(int argc, char **argv) argv[0 ], duration, nr_readers, rduration, wduration, nr_writers, wdelay, tot_reads, tot_writes, tot_reads + tot_writes); +free (test_rcu_pointer);free (tid_reader);free (tid_writer);free (count_reader);free (count_writer); +return 0 ; }tests/benchmark/test_urcu_defer.c +15
-14@@ -283,6 +283,7 @@ int main(int argc, char **argv)unsigned long long *count_reader;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -300,7 +301,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -368,15 +369,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + (void *)(long )i_thr);if (err !=0 )exit (1 ); }@@ -389,19 +390,19 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += tot_nr_writes[i]; + tot_writes += tot_nr_writes[i_thr]; } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "tests/benchmark/test_urcu_gc.c +29
-25@@ -304,6 +304,7 @@ int main(int argc, char **argv)unsigned long long *count_reader;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -321,7 +322,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -394,28 +395,29 @@ int main(int argc, char **argv) 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) + +if (reclaim_batch *sizeof (*pending_reclaims[0 ].queue) <CAA_CACHE_LINE_SIZE ) -for (i =0 ; i < nr_writers; i++) - pending_reclaims[i].queue =calloc (1 ,CAA_CACHE_LINE_SIZE ); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) + pending_reclaims[i_thr].queue =calloc (1 ,CAA_CACHE_LINE_SIZE );else -for (i =0 ; i < nr_writers; i++) - pending_reclaims[i].queue =calloc (reclaim_batch, -sizeof (*pending_reclaims[i].queue)); -for (i =0 ; i < nr_writers; i++) - pending_reclaims[i].head = pending_reclaims[i].queue; +for (i_thr =0 ; i_thr < nr_writers; i_thr++) + pending_reclaims[i_thr].queue =calloc (reclaim_batch, +sizeof (*pending_reclaims[i_thr].queue)); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) + pending_reclaims[i_thr].head = pending_reclaims[i_thr].queue; next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + (void *)(long )i_thr);if (err !=0 )exit (1 ); }@@ -428,20 +430,20 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += tot_nr_writes[i]; -rcu_gc_clear_queue (i); + tot_writes += tot_nr_writes[i_thr]; +rcu_gc_clear_queue (i_thr); } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "@@ -451,12 +453,14 @@ int main(int argc, char **argv) argv[0 ], duration, nr_readers, rduration, wduration, nr_writers, wdelay, tot_reads, tot_writes, tot_reads + tot_writes, reclaim_batch); +free (tid_reader);free (tid_writer);free (count_reader);free (tot_nr_writes); -for (i =0 ; i < nr_writers; i++) -free (pending_reclaims[i].queue); + +for (i_thr =0 ; i_thr < nr_writers; i_thr++) +free (pending_reclaims[i_thr].queue);free (pending_reclaims);return 0 ;tests/benchmark/test_urcu_hash.c +8
-7@@ -309,6 +309,7 @@ int main(int argc, char **argv)unsigned long count;long approx_before, approx_after;int i, a, ret, err, mainret =0 ; +unsigned int i_thr;struct sigaction act;unsigned int remain;unsigned int nr_readers_created =0 , nr_writers_created =0 ;@@ -333,7 +334,7 @@ int main(int argc, char **argv) mainret =1 ; goto end; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -618,10 +619,10 @@ int main(int argc, char **argv) goto end_close_pipe; } -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i], +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL ,get_thr_reader_cb (), - &count_reader[i]); + &count_reader[i_thr]);if (err !=0 ) { errno = err; mainret =1 ;@@ -630,10 +631,10 @@ int main(int argc, char **argv) } nr_readers_created++; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i], +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL ,get_thr_writer_cb (), - &count_writer[i]); + &count_writer[i_thr]);if (err !=0 ) { errno = err; mainret =1 ;@@ -655,26 +656,26 @@ int main(int argc, char **argv) test_stop =1 ;
end_pthread_join:tests/benchmark/test_urcu_hash.c +2
-2-for (i =0 ; i < nr_readers_created; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers_created; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err != 0) { errno = err; mainret = 1; perror("pthread_join"); }tests/benchmark/test_urcu_hash.c +1
-1- tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr];}tests/benchmark/test_urcu_hash.c +2
-2-for (i =0 ; i < nr_writers_created; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers_created; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err != 0) { errno = err; mainret = 1; perror("pthread_join"); }tests/benchmark/test_urcu_hash.c +4
-4- tot_writes += count_writer[i].update_ops; - tot_add += count_writer[i].add; - tot_add_exist += count_writer[i].add_exist; - tot_remove += count_writer[i].remove; + tot_writes += count_writer[i_thr].update_ops; + tot_add += count_writer[i_thr].add; + tot_add_exist += count_writer[i_thr].add_exist; + tot_remove += count_writer[i_thr].remove;} /* teardown counter thread */tests/benchmark/test_urcu_lfq.c +19
-17@@ -282,6 +282,7 @@ int main(int argc, char **argv) tot_successful_dequeues =0 ;unsigned long long end_dequeues =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -299,7 +300,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -360,15 +361,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_create (&tid_enqueuer[i],NULL , thr_enqueuer, - &count_enqueuer[2 * i]); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_create (&tid_enqueuer[i_thr],NULL , thr_enqueuer, + &count_enqueuer[2 * i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_create (&tid_dequeuer[i],NULL , thr_dequeuer, - &count_dequeuer[2 * i]); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_create (&tid_dequeuer[i_thr],NULL , thr_dequeuer, + &count_dequeuer[2 * i_thr]);if (err !=0 )exit (1 ); }@@ -377,7 +378,7 @@ int main(int argc, char **argv) test_go =1 ; -for (i =0 ; i < duration; i++) { +for (i_thr =0 ; i_thr < duration; i_thr++) {sleep (1 );if (verbose_mode) {fwrite ("." ,sizeof (char ),1 , stdout);@@ -387,21 +388,21 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_join (tid_enqueuer[i], &tret); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_join (tid_enqueuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_enqueues += count_enqueuer[2 * i]; - tot_successful_enqueues += count_enqueuer[2 * i +1 ]; + tot_enqueues += count_enqueuer[2 * i_thr]; + tot_successful_enqueues += count_enqueuer[2 * i_thr +1 ]; } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_join (tid_dequeuer[i], &tret); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_join (tid_dequeuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_dequeues += count_dequeuer[2 * i]; - tot_successful_dequeues += count_dequeuer[2 * i +1 ]; + tot_dequeues += count_dequeuer[2 * i_thr]; + tot_successful_dequeues += count_dequeuer[2 * i_thr +1 ]; } - +test_end (&q, &end_dequeues); err =cds_lfq_destroy_rcu (&q);assert (!err);@@ -432,5 +433,6 @@ int main(int argc, char **argv)free (count_dequeuer);free (tid_enqueuer);free (tid_dequeuer); +return 0 ; }tests/benchmark/test_urcu_lfs.c +19
-17@@ -349,6 +349,7 @@ int main(int argc, char **argv) tot_successful_dequeues =0 ;unsigned long long end_dequeues =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -366,7 +367,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -448,15 +449,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_create (&tid_enqueuer[i],NULL , thr_enqueuer, - &count_enqueuer[2 * i]); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_create (&tid_enqueuer[i_thr],NULL , thr_enqueuer, + &count_enqueuer[2 * i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_create (&tid_dequeuer[i],NULL , thr_dequeuer, - &count_dequeuer[2 * i]); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_create (&tid_dequeuer[i_thr],NULL , thr_dequeuer, + &count_dequeuer[2 * i_thr]);if (err !=0 )exit (1 ); }@@ -465,7 +466,7 @@ int main(int argc, char **argv) test_go =1 ; -for (i =0 ; i < duration; i++) { +for (i_thr =0 ; i_thr < duration; i_thr++) {sleep (1 );if (verbose_mode) {fwrite ("." ,sizeof (char ),1 , stdout);@@ -475,21 +476,21 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_join (tid_enqueuer[i], &tret); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_join (tid_enqueuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_enqueues += count_enqueuer[2 * i]; - tot_successful_enqueues += count_enqueuer[2 * i +1 ]; + tot_enqueues += count_enqueuer[2 * i_thr]; + tot_successful_enqueues += count_enqueuer[2 * i_thr +1 ]; } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_join (tid_dequeuer[i], &tret); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_join (tid_dequeuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_dequeues += count_dequeuer[2 * i]; - tot_successful_dequeues += count_dequeuer[2 * i +1 ]; + tot_dequeues += count_dequeuer[2 * i_thr]; + tot_successful_dequeues += count_dequeuer[2 * i_thr +1 ]; } - +test_end (&s, &end_dequeues); printf_verbose("total number of enqueues : %llu, dequeues %llu\n",@@ -519,5 +520,6 @@ int main(int argc, char **argv)free (count_dequeuer);free (tid_enqueuer);free (tid_dequeuer); +return 0 ; }tests/benchmark/test_urcu_lfs_rcu.c +18
-17@@ -284,6 +284,7 @@ int main(int argc, char **argv) tot_successful_dequeues =0 ;unsigned long long end_dequeues =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -301,7 +302,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -362,15 +363,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_create (&tid_enqueuer[i],NULL , thr_enqueuer, - &count_enqueuer[2 * i]); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_create (&tid_enqueuer[i_thr],NULL , thr_enqueuer, + &count_enqueuer[2 * i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_create (&tid_dequeuer[i],NULL , thr_dequeuer, - &count_dequeuer[2 * i]); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_create (&tid_dequeuer[i_thr],NULL , thr_dequeuer, + &count_dequeuer[2 * i_thr]);if (err !=0 )exit (1 ); }@@ -379,7 +380,7 @@ int main(int argc, char **argv) test_go =1 ; -for (i =0 ; i < duration; i++) { +for (i_thr =0 ; i_thr < duration; i_thr++) {sleep (1 );if (verbose_mode) {fwrite ("." ,sizeof (char ),1 , stdout);@@ -389,21 +390,21 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_join (tid_enqueuer[i], &tret); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_join (tid_enqueuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_enqueues += count_enqueuer[2 * i]; - tot_successful_enqueues += count_enqueuer[2 * i +1 ]; + tot_enqueues += count_enqueuer[2 * i_thr]; + tot_successful_enqueues += count_enqueuer[2 * i_thr +1 ]; } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_join (tid_dequeuer[i], &tret); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_join (tid_dequeuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_dequeues += count_dequeuer[2 * i]; - tot_successful_dequeues += count_dequeuer[2 * i +1 ]; + tot_dequeues += count_dequeuer[2 * i_thr]; + tot_successful_dequeues += count_dequeuer[2 * i_thr +1 ]; } - +test_end (&s, &end_dequeues); printf_verbose("total number of enqueues : %llu, dequeues %llu\n",tests/benchmark/test_urcu_qsbr.c +15
-14@@ -267,6 +267,7 @@ int main(int argc, char **argv)unsigned long long *count_reader, *count_writer;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -284,7 +285,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -352,15 +353,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - &count_writer[i]); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + &count_writer[i_thr]);if (err !=0 )exit (1 ); }@@ -373,19 +374,19 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += count_writer[i]; + tot_writes += count_writer[i_thr]; } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "tests/benchmark/test_urcu_qsbr_gc.c +28
-25@@ -306,6 +306,7 @@ int main(int argc, char **argv)unsigned long long *count_reader;unsigned long long tot_reads =0 , tot_writes =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -323,7 +324,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -396,28 +397,28 @@ int main(int argc, char **argv) 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) +if (reclaim_batch *sizeof (*pending_reclaims[0 ].queue) <CAA_CACHE_LINE_SIZE ) -for (i =0 ; i < nr_writers; i++) - pending_reclaims[i].queue =calloc (1 ,CAA_CACHE_LINE_SIZE ); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) + pending_reclaims[i_thr].queue =calloc (1 ,CAA_CACHE_LINE_SIZE );else -for (i =0 ; i < nr_writers; i++) - pending_reclaims[i].queue =calloc (reclaim_batch, -sizeof (*pending_reclaims[i].queue)); -for (i =0 ; i < nr_writers; i++) - pending_reclaims[i].head = pending_reclaims[i].queue; +for (i_thr =0 ; i_thr < nr_writers; i_thr++) + pending_reclaims[i_thr].queue =calloc (reclaim_batch, +sizeof (*pending_reclaims[i_thr].queue)); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) + pending_reclaims[i_thr].head = pending_reclaims[i_thr].queue; next_aff =0 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_create (&tid_reader[i],NULL , thr_reader, - &count_reader[i]); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_create (&tid_reader[i_thr],NULL , thr_reader, + &count_reader[i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_writers; i++) { - err =pthread_create (&tid_writer[i],NULL , thr_writer, - (void *)(long )i); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_create (&tid_writer[i_thr],NULL , thr_writer, + (void *)(long )i_thr);if (err !=0 )exit (1 ); }@@ -430,20 +431,20 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_readers; i++) { - err =pthread_join (tid_reader[i], &tret); +for (i_thr =0 ; i_thr < nr_readers; i_thr++) { + err =pthread_join (tid_reader[i_thr], &tret);if (err !=0 )exit (1 ); - tot_reads += count_reader[i]; + tot_reads += count_reader[i_thr]; } -for (i =0 ; i < nr_writers; i++) { - err =pthread_join (tid_writer[i], &tret); +for (i_thr =0 ; i_thr < nr_writers; i_thr++) { + err =pthread_join (tid_writer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_writes += tot_nr_writes[i]; -rcu_gc_clear_queue (i); + tot_writes += tot_nr_writes[i_thr]; +rcu_gc_clear_queue (i_thr); } - +printf_verbose ("total number of reads : %llu, writes %llu\n" , tot_reads, tot_writes); printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "@@ -453,12 +454,14 @@ int main(int argc, char **argv) argv[0 ], duration, nr_readers, rduration, wduration, nr_writers, wdelay, tot_reads, tot_writes, tot_reads + tot_writes, reclaim_batch); +free (tid_reader);free (tid_writer);free (count_reader);free (tot_nr_writes); -for (i =0 ; i < nr_writers; i++) -free (pending_reclaims[i].queue); + +for (i_thr =0 ; i_thr < nr_writers; i_thr++) +free (pending_reclaims[i_thr].queue);free (pending_reclaims);return 0 ;tests/benchmark/test_urcu_qsbr_timing.c +2
-2@@ -85,7 +85,7 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;void *thr_reader (void *arg) { -int i, j; +unsigned int i, j;struct test_array *local_ptr;caa_cycles_t time1, time2;@@ -122,7 +122,7 @@ void *thr_reader(void *arg)void *thr_writer (void *arg) { -int i, j; +unsigned int i, j;struct test_array *new, *old;caa_cycles_t time1, time2;tests/benchmark/test_urcu_timing.c +2
-2@@ -85,7 +85,7 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;void *thr_reader (void *arg) { -int i, j; +unsigned int i, j;struct test_array *local_ptr;caa_cycles_t time1, time2;@@ -121,7 +121,7 @@ void *thr_reader(void *arg)void *thr_writer (void *arg) { -int i, j; +unsigned int i, j;struct test_array *new, *old;caa_cycles_t time1, time2;tests/benchmark/test_urcu_wfcq.c +23
-21@@ -75,7 +75,7 @@ static inline void loop_sleep(unsigned long loops)static int verbose_mode;static int test_dequeue, test_splice, test_wait_empty; -static int test_enqueue_stopped; +static unsigned int test_enqueue_stopped; #define printf_verbose(fmt, args...) \ do { \@@ -357,6 +357,7 @@ int main(int argc, char **argv) tot_splice =0 , tot_dequeue_last =0 ;unsigned long long end_dequeues =0 ;int i, a, retval =0 ; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -374,7 +375,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -471,15 +472,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_create (&tid_enqueuer[i],NULL , thr_enqueuer, - &count_enqueuer[3 * i]); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_create (&tid_enqueuer[i_thr],NULL , thr_enqueuer, + &count_enqueuer[3 * i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_create (&tid_dequeuer[i],NULL , thr_dequeuer, - &count_dequeuer[4 * i]); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_create (&tid_dequeuer[i_thr],NULL , thr_dequeuer, + &count_dequeuer[4 * i_thr]);if (err !=0 )exit (1 ); }@@ -488,7 +489,7 @@ int main(int argc, char **argv) test_go =1 ; -for (i =0 ; i < duration; i++) { +for (i_thr =0 ; i_thr < duration; i_thr++) {sleep (1 );if (verbose_mode) {fwrite ("." ,sizeof (char ),1 , stdout);@@ -509,24 +510,24 @@ int main(int argc, char **argv) test_stop_dequeue =1 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_join (tid_enqueuer[i], &tret); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_join (tid_enqueuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_enqueues += count_enqueuer[3 * i]; - tot_successful_enqueues += count_enqueuer[3 * i +1 ]; - tot_empty_dest_enqueues += count_enqueuer[3 * i +2 ]; + tot_enqueues += count_enqueuer[3 * i_thr]; + tot_successful_enqueues += count_enqueuer[3 * i_thr +1 ]; + tot_empty_dest_enqueues += count_enqueuer[3 * i_thr +2 ]; } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_join (tid_dequeuer[i], &tret); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_join (tid_dequeuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_dequeues += count_dequeuer[4 * i]; - tot_successful_dequeues += count_dequeuer[4 * i +1 ]; - tot_splice += count_dequeuer[4 * i +2 ]; - tot_dequeue_last += count_dequeuer[4 * i +3 ]; + tot_dequeues += count_dequeuer[4 * i_thr]; + tot_successful_dequeues += count_dequeuer[4 * i_thr +1 ]; + tot_splice += count_dequeuer[4 * i_thr +2 ]; + tot_dequeue_last += count_dequeuer[4 * i_thr +3 ]; } - +test_end (&end_dequeues, &tot_dequeue_last); printf_verbose("total number of enqueues : %llu, dequeues %llu\n",@@ -579,5 +580,6 @@ int main(int argc, char **argv)free (count_dequeuer);free (tid_enqueuer);free (tid_dequeuer); +return retval; }tests/benchmark/test_urcu_wfq.c +19
-17@@ -254,6 +254,7 @@ int main(int argc, char **argv) tot_successful_dequeues =0 ;unsigned long long end_dequeues =0 ;int i, a; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -271,7 +272,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -328,15 +329,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_create (&tid_enqueuer[i],NULL , thr_enqueuer, - &count_enqueuer[2 * i]); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_create (&tid_enqueuer[i_thr],NULL , thr_enqueuer, + &count_enqueuer[2 * i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_create (&tid_dequeuer[i],NULL , thr_dequeuer, - &count_dequeuer[2 * i]); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_create (&tid_dequeuer[i_thr],NULL , thr_dequeuer, + &count_dequeuer[2 * i_thr]);if (err !=0 )exit (1 ); }@@ -345,7 +346,7 @@ int main(int argc, char **argv) test_go =1 ; -for (i =0 ; i < duration; i++) { +for (i_thr =0 ; i_thr < duration; i_thr++) {sleep (1 );if (verbose_mode) {fwrite ("." ,sizeof (char ),1 , stdout);@@ -355,21 +356,21 @@ int main(int argc, char **argv) test_stop =1 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_join (tid_enqueuer[i], &tret); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_join (tid_enqueuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_enqueues += count_enqueuer[2 * i]; - tot_successful_enqueues += count_enqueuer[2 * i +1 ]; + tot_enqueues += count_enqueuer[2 * i_thr]; + tot_successful_enqueues += count_enqueuer[2 * i_thr +1 ]; } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_join (tid_dequeuer[i], &tret); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_join (tid_dequeuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_dequeues += count_dequeuer[2 * i]; - tot_successful_dequeues += count_dequeuer[2 * i +1 ]; + tot_dequeues += count_dequeuer[2 * i_thr]; + tot_successful_dequeues += count_dequeuer[2 * i_thr +1 ]; } - +test_end (&q, &end_dequeues); printf_verbose("total number of enqueues : %llu, dequeues %llu\n",@@ -398,5 +399,6 @@ int main(int argc, char **argv)free (count_dequeuer);free (tid_enqueuer);free (tid_dequeuer); +return 0 ; }tests/benchmark/test_urcu_wfs.c +23
-21@@ -78,7 +78,7 @@ static inline void loop_sleep(unsigned long loops)static int verbose_mode;static int test_pop, test_pop_all, test_wait_empty; -static int test_enqueue_stopped; +static unsigned int test_enqueue_stopped; #define printf_verbose(fmt, args...) \ do { \@@ -344,6 +344,7 @@ int main(int argc, char **argv) tot_pop_all =0 , tot_pop_last =0 ;unsigned long long end_dequeues =0 ;int i, a, retval =0 ; +unsigned int i_thr;if (argc <4 ) {show_usage (argc, argv);@@ -361,7 +362,7 @@ int main(int argc, char **argv)show_usage (argc, argv);return -1 ; } - + err =sscanf (argv[3 ],"%lu" , &duration);if (err !=1 ) {show_usage (argc, argv);@@ -458,15 +459,15 @@ int main(int argc, char **argv) next_aff =0 ; -for (i =0 ; i < nr_enqueuers; i++) { +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { err =pthread_create (&tid_enqueuer[i],NULL , thr_enqueuer, - &count_enqueuer[3 * i]); + &count_enqueuer[3 * i_thr]);if (err !=0 )exit (1 ); } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_create (&tid_dequeuer[i],NULL , thr_dequeuer, - &count_dequeuer[4 * i]); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_create (&tid_dequeuer[i_thr],NULL , thr_dequeuer, + &count_dequeuer[4 * i_thr]);if (err !=0 )exit (1 ); }@@ -475,7 +476,7 @@ int main(int argc, char **argv) test_go =1 ; -for (i =0 ; i < duration; i++) { +for (i_thr =0 ; i_thr < duration; i_thr++) {sleep (1 );if (verbose_mode) {fwrite ("." ,sizeof (char ),1 , stdout);@@ -496,24 +497,24 @@ int main(int argc, char **argv) test_stop_dequeue =1 ; -for (i =0 ; i < nr_enqueuers; i++) { - err =pthread_join (tid_enqueuer[i], &tret); +for (i_thr =0 ; i_thr < nr_enqueuers; i_thr++) { + err =pthread_join (tid_enqueuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_enqueues += count_enqueuer[3 * i]; - tot_successful_enqueues += count_enqueuer[3 * i +1 ]; - tot_empty_dest_enqueues += count_enqueuer[3 * i +2 ]; + tot_enqueues += count_enqueuer[3 * i_thr]; + tot_successful_enqueues += count_enqueuer[3 * i_thr +1 ]; + tot_empty_dest_enqueues += count_enqueuer[3 * i_thr +2 ]; } -for (i =0 ; i < nr_dequeuers; i++) { - err =pthread_join (tid_dequeuer[i], &tret); +for (i_thr =0 ; i_thr < nr_dequeuers; i_thr++) { + err =pthread_join (tid_dequeuer[i_thr], &tret);if (err !=0 )exit (1 ); - tot_dequeues += count_dequeuer[4 * i]; - tot_successful_dequeues += count_dequeuer[4 * i +1 ]; - tot_pop_all += count_dequeuer[4 * i +2 ]; - tot_pop_last += count_dequeuer[4 * i +3 ]; + tot_dequeues += count_dequeuer[4 * i_thr]; + tot_successful_dequeues += count_dequeuer[4 * i_thr +1 ]; + tot_pop_all += count_dequeuer[4 * i_thr +2 ]; + tot_pop_last += count_dequeuer[4 * i_thr +3 ]; } - +test_end (&s, &end_dequeues, &tot_pop_last); printf_verbose("total number of enqueues : %llu, dequeues %llu\n",@@ -557,10 +558,12 @@ int main(int argc, char **argv) tot_pop_last); retval =1 ; } +cds_wfs_destroy (&s);free (count_enqueuer);free (count_dequeuer);free (tid_enqueuer);free (tid_dequeuer); +return retval; } --2.17.1
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com