X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=test_qsbr.c;h=7ff1aca9c7600994f5b2ad30d79d0ca7fd3a0e60;hp=f56234b564c8bac4a6d01ff1b2eede53beba3e0f;hb=8b632babd61dd1708c4cf95f1f417469f8f6a528;hpb=b4fde1d45c43e18b0589a983509bea738c54cbce diff --git a/test_qsbr.c b/test_qsbr.c index f56234b..7ff1aca 100644 --- a/test_qsbr.c +++ b/test_qsbr.c @@ -65,6 +65,9 @@ static struct test_array *test_rcu_pointer; static unsigned long duration; +/* read-side C.S. duration, in us */ +static unsigned long rduration; + /* * returns 0 if test should end. */ @@ -164,6 +167,8 @@ void *thr_reader(void *_count) debug_yield_read(); if (local_ptr) assert(local_ptr->a == 8); + if (unlikely(rduration)) + usleep(rduration); _rcu_read_unlock(); nr_reads++; /* QS each 1024 reads */ @@ -228,6 +233,7 @@ void show_usage(int argc, char **argv) printf(" [-r] [-w] (yield reader and/or writer)"); #endif printf(" [-d delay] (writer period (us))"); + printf(" [-c duration] (reader C.S. duration (us))"); printf(" [-a cpu#] [-a cpu#]... (affinity)"); printf("\n"); } @@ -291,6 +297,13 @@ int main(int argc, char **argv) use_affinity = 1; printf("Adding CPU %d affinity\n", a); break; + case 'c': + if (argc < i + 2) { + show_usage(argc, argv); + return -1; + } + rduration = atoi(argv[++i]); + break; case 'd': if (argc < i + 2) { show_usage(argc, argv);