X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_wfs.c;h=7746a1d17447e332c1e88b6cf18523c49c57f439;hb=cc6b0c208a9707f8a64609a51167290caeace288;hp=f50b1400ffdd95d847d19ef8e256677982ffd734;hpb=cb3f3d6bce4faeb41e4109e12fa722f73a6f6c13;p=urcu.git diff --git a/tests/test_urcu_wfs.c b/tests/test_urcu_wfs.c index f50b140..7746a1d 100644 --- a/tests/test_urcu_wfs.c +++ b/tests/test_urcu_wfs.c @@ -34,12 +34,15 @@ #include #include #include -#include #include #include #include +#ifdef __linux__ +#include +#endif + /* hardcoded number of CPUs */ #define NR_CPUS 16384 @@ -76,7 +79,7 @@ static unsigned long wdelay; static inline void loop_sleep(unsigned long l) { while(l-- != 0) - cpu_relax(); + caa_cpu_relax(); } static int verbose_mode; @@ -153,7 +156,7 @@ static unsigned long long __thread nr_successful_enqueues; static unsigned int nr_enqueuers; static unsigned int nr_dequeuers; -static struct wfs_stack s; +static struct cds_wfs_stack s; void *thr_enqueuer(void *_count) { @@ -167,21 +170,21 @@ void *thr_enqueuer(void *_count) while (!test_go) { } - smp_mb(); + cmm_smp_mb(); for (;;) { - struct wfs_node *node = malloc(sizeof(*node)); + struct cds_wfs_node *node = malloc(sizeof(*node)); if (!node) goto fail; - wfs_node_init(node); - wfs_push(&s, node); + cds_wfs_node_init(node); + cds_wfs_push(&s, node); nr_successful_enqueues++; - if (unlikely(wdelay)) + if (caa_unlikely(wdelay)) loop_sleep(wdelay); fail: nr_enqueues++; - if (unlikely(!test_duration_enqueue())) + if (caa_unlikely(!test_duration_enqueue())) break; } @@ -207,10 +210,10 @@ void *thr_dequeuer(void *_count) while (!test_go) { } - smp_mb(); + cmm_smp_mb(); for (;;) { - struct wfs_node *node = wfs_pop_blocking(&s); + struct cds_wfs_node *node = cds_wfs_pop_blocking(&s); if (node) { free(node); @@ -218,9 +221,9 @@ void *thr_dequeuer(void *_count) } nr_dequeues++; - if (unlikely(!test_duration_dequeue())) + if (caa_unlikely(!test_duration_dequeue())) break; - if (unlikely(rduration)) + if (caa_unlikely(rduration)) loop_sleep(rduration); } @@ -233,12 +236,12 @@ void *thr_dequeuer(void *_count) return ((void*)2); } -void test_end(struct wfs_stack *s, unsigned long long *nr_dequeues) +void test_end(struct cds_wfs_stack *s, unsigned long long *nr_dequeues) { - struct wfs_node *node; + struct cds_wfs_node *node; do { - node = wfs_pop_blocking(s); + node = cds_wfs_pop_blocking(s); if (node) { free(node); (*nr_dequeues)++; @@ -337,7 +340,7 @@ int main(int argc, char **argv) tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers); count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers); count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers); - wfs_init(&s); + cds_wfs_init(&s); next_aff = 0; @@ -354,7 +357,7 @@ int main(int argc, char **argv) exit(1); } - smp_mb(); + cmm_smp_mb(); test_go = 1;