X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Fbenchmark%2Ftest_urcu_bp.c;h=cf5c0fe074b2b2793e2a70e4670bf03d51e92ff3;hp=9c336e56a2d676047a2b592ce80486061bd5c0f3;hb=0614a2e61ccbf150cc51d4fd3073b285983417c5;hpb=2650042a5405028da49bfcfb71053b78a56a9ed4 diff --git a/tests/benchmark/test_urcu_bp.c b/tests/benchmark/test_urcu_bp.c index 9c336e5..cf5c0fe 100644 --- a/tests/benchmark/test_urcu_bp.c +++ b/tests/benchmark/test_urcu_bp.c @@ -20,8 +20,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE -#include "config.h" #include #include #include @@ -35,7 +33,6 @@ #include #include -#include "cpuset.h" #include "thread-id.h" #include "../common/debug-yield.h" @@ -106,11 +103,7 @@ static void set_affinity(void) CPU_ZERO(&mask); CPU_SET(cpu, &mask); -#if SCHED_SETAFFINITY_ARGS == 2 - sched_setaffinity(0, &mask); -#else sched_setaffinity(0, sizeof(mask), &mask); -#endif #endif /* HAVE_SCHED_SETAFFINITY */ } @@ -258,6 +251,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); @@ -275,7 +269,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); @@ -343,15 +337,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); } @@ -364,19 +358,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 " @@ -385,10 +379,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; }