projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: powerpc32: transparent unions alter calling convention
[urcu.git]
/
tests
/
benchmark
/
test_urcu_lfq.c
diff --git
a/tests/benchmark/test_urcu_lfq.c
b/tests/benchmark/test_urcu_lfq.c
index 45a6bb9eafc0ee9dfbbdd9a293245b0bf51ee377..490e8b0527154f3f55edcf9beb0c44e0a1080aa5 100644
(file)
--- a/
tests/benchmark/test_urcu_lfq.c
+++ b/
tests/benchmark/test_urcu_lfq.c
@@
-31,10
+31,10
@@
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include <urcu/tls-compat.h>
#include "thread-id.h"
@@
-78,7
+78,7
@@
pthread_mutex_t affinity_mutex = PTHREAD_MUTEX_INITIALIZER;
static void set_affinity(void)
{
static void set_affinity(void)
{
-#if HAVE_SCHED_SETAFFINITY
+#if
def
HAVE_SCHED_SETAFFINITY
cpu_set_t mask;
int cpu, ret;
#endif /* HAVE_SCHED_SETAFFINITY */
cpu_set_t mask;
int cpu, ret;
#endif /* HAVE_SCHED_SETAFFINITY */
@@
-86,7
+86,7
@@
static void set_affinity(void)
if (!use_affinity)
return;
if (!use_affinity)
return;
-#if HAVE_SCHED_SETAFFINITY
+#if
def
HAVE_SCHED_SETAFFINITY
ret = pthread_mutex_lock(&affinity_mutex);
if (ret) {
perror("Error in pthread mutex lock");
ret = pthread_mutex_lock(&affinity_mutex);
if (ret) {
perror("Error in pthread mutex lock");
@@
-134,6
+134,7
@@
struct test {
static struct cds_lfq_queue_rcu q;
static struct cds_lfq_queue_rcu q;
+static
void *thr_enqueuer(void *_count)
{
unsigned long long *count = _count;
void *thr_enqueuer(void *_count)
{
unsigned long long *count = _count;
@@
-189,6
+190,7
@@
void free_node_cb(struct rcu_head *head)
free(node);
}
free(node);
}
+static
void *thr_dequeuer(void *_count)
{
unsigned long long *count = _count;
void *thr_dequeuer(void *_count)
{
unsigned long long *count = _count;
@@
-238,23
+240,25
@@
void *thr_dequeuer(void *_count)
return ((void*)2);
}
return ((void*)2);
}
-void test_end(struct cds_lfq_queue_rcu *q, unsigned long long *nr_dequeues)
+static
+void test_end(unsigned long long *nr_dequeues_l)
{
struct cds_lfq_node_rcu *snode;
do {
{
struct cds_lfq_node_rcu *snode;
do {
- snode = cds_lfq_dequeue_rcu(q);
+ snode = cds_lfq_dequeue_rcu(
&
q);
if (snode) {
struct test *node;
node = caa_container_of(snode, struct test, list);
free(node); /* no more concurrent access */
if (snode) {
struct test *node;
node = caa_container_of(snode, struct test, list);
free(node); /* no more concurrent access */
- (*nr_dequeues)++;
+ (*nr_dequeues
_l
)++;
}
} while (snode);
}
}
} while (snode);
}
-void show_usage(int argc, char **argv)
+static
+void show_usage(char **argv)
{
printf("Usage : %s nr_dequeuers nr_enqueuers duration (s) <OPTIONS>\n",
argv[0]);
{
printf("Usage : %s nr_dequeuers nr_enqueuers duration (s) <OPTIONS>\n",
argv[0]);
@@
-280,25
+284,25
@@
int main(int argc, char **argv)
unsigned int i_thr;
if (argc < 4) {
unsigned int i_thr;
if (argc < 4) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
err = sscanf(argv[1], "%u", &nr_dequeuers);
if (err != 1) {
return -1;
}
err = sscanf(argv[1], "%u", &nr_dequeuers);
if (err != 1) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
err = sscanf(argv[2], "%u", &nr_enqueuers);
if (err != 1) {
return -1;
}
err = sscanf(argv[2], "%u", &nr_enqueuers);
if (err != 1) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
err = sscanf(argv[3], "%lu", &duration);
if (err != 1) {
return -1;
}
err = sscanf(argv[3], "%lu", &duration);
if (err != 1) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
return -1;
}
@@
-308,7
+312,7
@@
int main(int argc, char **argv)
switch (argv[i][1]) {
case 'a':
if (argc < i + 2) {
switch (argv[i][1]) {
case 'a':
if (argc < i + 2) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
a = atoi(argv[++i]);
return -1;
}
a = atoi(argv[++i]);
@@
-318,14
+322,14
@@
int main(int argc, char **argv)
break;
case 'c':
if (argc < i + 2) {
break;
case 'c':
if (argc < i + 2) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
rduration = atol(argv[++i]);
break;
case 'd':
if (argc < i + 2) {
return -1;
}
rduration = atol(argv[++i]);
break;
case 'd':
if (argc < i + 2) {
- show_usage(arg
c, arg
v);
+ show_usage(argv);
return -1;
}
wdelay = atol(argv[++i]);
return -1;
}
wdelay = atol(argv[++i]);
@@
-398,9
+402,9
@@
int main(int argc, char **argv)
tot_successful_dequeues += count_dequeuer[2 * i_thr + 1];
}
tot_successful_dequeues += count_dequeuer[2 * i_thr + 1];
}
- test_end(&
q, &
end_dequeues);
+ test_end(&end_dequeues);
err = cds_lfq_destroy_rcu(&q);
err = cds_lfq_destroy_rcu(&q);
- assert(!err);
+
urcu_posix_
assert(!err);
printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
tot_enqueues, tot_dequeues);
printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
tot_enqueues, tot_dequeues);
This page took
0.026528 seconds
and
4
git commands to generate.