projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename likely/unlikely to caa_likely/caa_unlikely
[userspace-rcu.git]
/
tests
/
test_rwlock.c
diff --git
a/tests/test_rwlock.c
b/tests/test_rwlock.c
index 4629a44b5b2e87c601b157150c769ca8918857e6..34d8c0727b271aab00241173154c9c8f825fc4a1 100644
(file)
--- a/
tests/test_rwlock.c
+++ b/
tests/test_rwlock.c
@@
-3,7
+3,7
@@
*
* Userspace RCU library - test program
*
*
* Userspace RCU library - test program
*
- * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@
polymtl.ca
>
+ * Copyright February 2009 - Mathieu Desnoyers <mathieu.desnoyers@
efficios.com
>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-31,12
+31,15
@@
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
+#ifdef __linux__
+#include <syscall.h>
+#endif
+
/* hardcoded number of CPUs */
#define NR_CPUS 16384
/* hardcoded number of CPUs */
#define NR_CPUS 16384
@@
-85,7
+88,7
@@
static unsigned long wduration;
static inline void loop_sleep(unsigned long l)
{
while(l-- != 0)
static inline void loop_sleep(unsigned long l)
{
while(l-- != 0)
- cpu_relax();
+ c
aa_c
pu_relax();
}
static int verbose_mode;
}
static int verbose_mode;
@@
-198,11
+201,11
@@
void *thr_reader(void *_count)
for (;;) {
pthread_rwlock_rdlock(&lock);
assert(test_array.a == 8);
for (;;) {
pthread_rwlock_rdlock(&lock);
assert(test_array.a == 8);
- if (unlikely(rduration))
+ if (
caa_
unlikely(rduration))
loop_sleep(rduration);
pthread_rwlock_unlock(&lock);
nr_reads++;
loop_sleep(rduration);
pthread_rwlock_unlock(&lock);
nr_reads++;
- if (unlikely(!test_duration_read()))
+ if (
caa_
unlikely(!test_duration_read()))
break;
}
break;
}
@@
-225,19
+228,19
@@
void *thr_writer(void *_count)
while (!test_go)
{
}
while (!test_go)
{
}
- smp_mb();
+
cmm_
smp_mb();
for (;;) {
pthread_rwlock_wrlock(&lock);
test_array.a = 0;
test_array.a = 8;
for (;;) {
pthread_rwlock_wrlock(&lock);
test_array.a = 0;
test_array.a = 8;
- if (unlikely(wduration))
+ if (
caa_
unlikely(wduration))
loop_sleep(wduration);
pthread_rwlock_unlock(&lock);
nr_writes++;
loop_sleep(wduration);
pthread_rwlock_unlock(&lock);
nr_writes++;
- if (unlikely(!test_duration_write()))
+ if (
caa_
unlikely(!test_duration_write()))
break;
break;
- if (unlikely(wdelay))
+ if (
caa_
unlikely(wdelay))
loop_sleep(wdelay);
}
loop_sleep(wdelay);
}
@@
-274,7
+277,7
@@
int main(int argc, char **argv)
show_usage(argc, argv);
return -1;
}
show_usage(argc, argv);
return -1;
}
- smp_mb();
+
cmm_
smp_mb();
err = sscanf(argv[1], "%u", &nr_readers);
if (err != 1) {
err = sscanf(argv[1], "%u", &nr_readers);
if (err != 1) {
@@
-370,7
+373,7
@@
int main(int argc, char **argv)
exit(1);
}
exit(1);
}
- smp_mb();
+
cmm_
smp_mb();
test_go = 1;
test_go = 1;
@@
-393,10
+396,10
@@
int main(int argc, char **argv)
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
- printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu "
+ printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu
wdur %6lu
"
"nr_writers %3u "
"wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu\n",
"nr_writers %3u "
"wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu\n",
- argv[0], duration, nr_readers, rduration,
+ argv[0], duration, nr_readers, rduration,
wduration,
nr_writers, wdelay, tot_reads, tot_writes,
tot_reads + tot_writes);
nr_writers, wdelay, tot_reads, tot_writes,
tot_reads + tot_writes);
This page took
0.027247 seconds
and
4
git commands to generate.