projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into lfqueue-dev
[urcu.git]
/
tests
/
test_rwlock_timing.c
diff --git
a/tests/test_rwlock_timing.c
b/tests/test_rwlock_timing.c
index b26f83dcc9035c20ea878896bc8b1477eaa64a76..628bed459af61e38afada3626e2b05e8dd659ab6 100644
(file)
--- a/
tests/test_rwlock_timing.c
+++ b/
tests/test_rwlock_timing.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
@@
-20,6
+20,7
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
@@
-29,12
+30,14
@@
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/syscall.h>
#include <pthread.h>
#include <pthread.h>
+#include <errno.h>
+
#include <urcu/arch.h>
#include <urcu/arch.h>
-/* Make this big enough to include the POWER5+ L3 cacheline size of 256B */
-#define CACHE_LINE_SIZE 4096
+#ifdef __linux__
+#include <syscall.h>
+#endif
#if defined(_syscall0)
_syscall0(pid_t, gettid)
#if defined(_syscall0)
_syscall0(pid_t, gettid)
@@
-75,8
+78,8
@@
static int num_write;
#define NR_READ num_read
#define NR_WRITE num_write
#define NR_READ num_read
#define NR_WRITE num_write
-static cycles_t __attribute__((aligned(CACHE_LINE_SIZE))) *reader_time;
-static cycles_t __attribute__((aligned(CACHE_LINE_SIZE))) *writer_time;
+static cycles_t __attribute__((aligned(CA
A_CA
CHE_LINE_SIZE))) *reader_time;
+static cycles_t __attribute__((aligned(CA
A_CA
CHE_LINE_SIZE))) *writer_time;
void *thr_reader(void *arg)
{
void *thr_reader(void *arg)
{
@@
-87,7
+90,7
@@
void *thr_reader(void *arg)
"reader", pthread_self(), (unsigned long)gettid());
sleep(2);
"reader", pthread_self(), (unsigned long)gettid());
sleep(2);
- time1 = get_cycles();
+ time1 =
caa_
get_cycles();
for (i = 0; i < OUTER_READ_LOOP; i++) {
for (j = 0; j < INNER_READ_LOOP; j++) {
pthread_rwlock_rdlock(&lock);
for (i = 0; i < OUTER_READ_LOOP; i++) {
for (j = 0; j < INNER_READ_LOOP; j++) {
pthread_rwlock_rdlock(&lock);
@@
-95,7
+98,7
@@
void *thr_reader(void *arg)
pthread_rwlock_unlock(&lock);
}
}
pthread_rwlock_unlock(&lock);
}
}
- time2 = get_cycles();
+ time2 =
caa_
get_cycles();
reader_time[(unsigned long)arg] = time2 - time1;
reader_time[(unsigned long)arg] = time2 - time1;
@@
-117,11
+120,11
@@
void *thr_writer(void *arg)
for (i = 0; i < OUTER_WRITE_LOOP; i++) {
for (j = 0; j < INNER_WRITE_LOOP; j++) {
for (i = 0; i < OUTER_WRITE_LOOP; i++) {
for (j = 0; j < INNER_WRITE_LOOP; j++) {
- time1 = get_cycles();
+ time1 =
caa_
get_cycles();
pthread_rwlock_wrlock(&lock);
test_array.a = 8;
pthread_rwlock_unlock(&lock);
pthread_rwlock_wrlock(&lock);
test_array.a = 8;
pthread_rwlock_unlock(&lock);
- time2 = get_cycles();
+ time2 =
caa_
get_cycles();
writer_time[(unsigned long)arg] += time2 - time1;
usleep(1);
}
writer_time[(unsigned long)arg] += time2 - time1;
usleep(1);
}
This page took
0.024832 seconds
and
4
git commands to generate.