projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
benchmark: Use uatomic for accessing global states
[userspace-rcu.git]
/
tests
/
benchmark
/
test_urcu_lfs.c
diff --git
a/tests/benchmark/test_urcu_lfs.c
b/tests/benchmark/test_urcu_lfs.c
index c070021e395e2211892e573f44a29352da7c2eee..933f0b37bfdb01c6ce8d8d618b4945569e983d61 100644
(file)
--- a/
tests/benchmark/test_urcu_lfs.c
+++ b/
tests/benchmark/test_urcu_lfs.c
@@
-45,8
+45,6
@@
enum test_sync {
static enum test_sync test_sync;
static enum test_sync test_sync;
-static volatile int test_go, test_stop;
-
static unsigned long rduration;
static unsigned long duration;
static unsigned long rduration;
static unsigned long duration;
@@
-110,12
+108,12
@@
static void set_affinity(void)
*/
static int test_duration_dequeue(void)
{
*/
static int test_duration_dequeue(void)
{
- return
!test_stop
;
+ return
test_duration_read()
;
}
static int test_duration_enqueue(void)
{
}
static int test_duration_enqueue(void)
{
- return
!test_stop
;
+ return
test_duration_write()
;
}
static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
}
static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
@@
-145,10
+143,7
@@
static void *thr_enqueuer(void *_count)
rcu_register_thread();
rcu_register_thread();
- while (!test_go)
- {
- }
- cmm_smp_mb();
+ wait_until_go();
for (;;) {
struct test *node = malloc(sizeof(*node));
for (;;) {
struct test *node = malloc(sizeof(*node));
@@
-247,10
+242,7
@@
static void *thr_dequeuer(void *_count)
rcu_register_thread();
rcu_register_thread();
- while (!test_go)
- {
- }
- cmm_smp_mb();
+ wait_until_go();
urcu_posix_assert(test_pop || test_pop_all);
urcu_posix_assert(test_pop || test_pop_all);
@@
-445,7
+437,7
@@
int main(int argc, char **argv)
cmm_smp_mb();
cmm_smp_mb();
-
test_go = 1
;
+
begin_test()
;
for (i_thr = 0; i_thr < duration; i_thr++) {
sleep(1);
for (i_thr = 0; i_thr < duration; i_thr++) {
sleep(1);
@@
-455,7
+447,7
@@
int main(int argc, char **argv)
}
}
}
}
-
test_stop = 1
;
+
end_test()
;
for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
err = pthread_join(tid_enqueuer[i_thr], &tret);
for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
err = pthread_join(tid_enqueuer[i_thr], &tret);
This page took
0.023621 seconds
and
4
git commands to generate.