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_wfq.c
diff --git
a/tests/benchmark/test_urcu_wfq.c
b/tests/benchmark/test_urcu_wfq.c
index c11f63980068c806abea49f322ec9902d82aba8d..b17df5ac37787b432c3456a82ecba6b21303e03f 100644
(file)
--- a/
tests/benchmark/test_urcu_wfq.c
+++ b/
tests/benchmark/test_urcu_wfq.c
@@
-37,8
+37,6
@@
#include <urcu.h>
#include <urcu/wfqueue.h>
#include <urcu.h>
#include <urcu/wfqueue.h>
-static volatile int test_go, test_stop;
-
static unsigned long rduration;
static unsigned long duration;
static unsigned long rduration;
static unsigned long duration;
@@
-100,12
+98,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);
@@
-129,10
+127,7
@@
void *thr_enqueuer(void *_count)
set_affinity();
set_affinity();
- while (!test_go)
- {
- }
- cmm_smp_mb();
+ wait_until_go();
for (;;) {
struct cds_wfq_node *node = malloc(sizeof(*node));
for (;;) {
struct cds_wfq_node *node = malloc(sizeof(*node));
@@
-171,10
+166,7
@@
void *thr_dequeuer(void *_count)
set_affinity();
set_affinity();
- while (!test_go)
- {
- }
- cmm_smp_mb();
+ wait_until_go();
for (;;) {
struct cds_wfq_node *node = cds_wfq_dequeue_blocking(&q);
for (;;) {
struct cds_wfq_node *node = cds_wfq_dequeue_blocking(&q);
@@
-329,7
+321,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);
@@
-339,7
+331,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.032024 seconds
and
4
git commands to generate.