X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Fbenchmark%2Ftest_urcu_defer.c;fp=tests%2Fbenchmark%2Ftest_urcu_defer.c;h=df8e335ec898a396e6ed4958ac9e76e419a6038c;hp=0a4964176cd7c77b331019f1cd29ea21d957f1aa;hb=83e334d03eaba62df373cf44298616458900078a;hpb=99ab1528d4df0c35bd209063c42123d1bc2f81ea diff --git a/tests/benchmark/test_urcu_defer.c b/tests/benchmark/test_urcu_defer.c index 0a49641..df8e335 100644 --- a/tests/benchmark/test_urcu_defer.c +++ b/tests/benchmark/test_urcu_defer.c @@ -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 "