Add rcutorture with yield
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 9 Feb 2009 06:44:01 +0000 (01:44 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 9 Feb 2009 06:44:01 +0000 (01:44 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Makefile
rcutorture.h
urcu.h
urcutorture.c

index 566a9421e80aa29e907bf61eba9f4d906f20fc89..4b5f24efe94ccc05895e591bfbf8b8904269245a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ LDFLAGS=-lpthread
 SRC_DEP=`echo $^ | sed 's/[^ ]*.h//g'`
 
 all: test_urcu test_urcu_timing test_rwlock_timing test_urcu_yield urcu-asm.S \
-       urcu-asm.o
+       urcu-asm.o urcutorture urcutorture-yield
 
 test_urcu: urcu.o test_urcu.c urcu.h
        $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
@@ -33,10 +33,12 @@ urcu-asm.S: urcu-asm.c urcu.h
 urcu-asm.o: urcu-asm.c urcu.h
        $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP)
 
-#in progress...
 urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h
        $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
 
+urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h
+       $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
 .PHONY: clean
 
 clean:
index 7a19fed0e5e53fcd91665a50ba4efb7c0ed17372..bda2ad575cdcb86b34ab5a100e49cffae96d1685 100644 (file)
@@ -392,6 +392,11 @@ int main(int argc, char *argv[])
        smp_init();
        //rcu_init();
 
+#ifdef DEBUG_YIELD
+       yield_active |= YIELD_READ;
+       yield_active |= YIELD_WRITE;
+#endif
+
        if (argc > 1) {
                nreaders = strtoul(argv[1], NULL, 0);
                if (argc == 2)
diff --git a/urcu.h b/urcu.h
index fb8cedf3e15beab5ba5355b153d0bb999fa1c7fc..bc86d435845d6da33255a63d7d5d2fbdecb4aa76 100644 (file)
--- a/urcu.h
+++ b/urcu.h
@@ -17,6 +17,7 @@
  * Distributed under GPLv2
  */
 
+#define __USE_GNU
 #include <stdlib.h>
 
 /* The "volatile" is due to gcc bugs */
@@ -109,6 +110,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
 
 #ifdef DEBUG_YIELD
 #include <sched.h>
+#include <time.h>
+#include <pthread.h>
 
 #define YIELD_READ     (1 << 0)
 #define YIELD_WRITE    (1 << 1)
index 7d672fdbac151adc608a33e8e060d3ec90b067f1..258413a5a362d98cb8885e7ce459cf69b1fb83ee 100644 (file)
@@ -3,6 +3,6 @@
 #include <poll.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include "urcu.h"
 #include "api.h"
+#include "urcu.h"
 #include "rcutorture.h"
This page took 0.026693 seconds and 4 git commands to generate.