add linked list traversal benchmark
authorbdemsky <bdemsky>
Mon, 5 May 2008 04:45:20 +0000 (04:45 +0000)
committerbdemsky <bdemsky>
Mon, 5 May 2008 04:45:20 +0000 (04:45 +0000)
Robust/src/Benchmarks/Prefetch/Chase/Chase.java [new file with mode: 0644]
Robust/src/Benchmarks/Prefetch/Chase/makefile [new file with mode: 0644]

diff --git a/Robust/src/Benchmarks/Prefetch/Chase/Chase.java b/Robust/src/Benchmarks/Prefetch/Chase/Chase.java
new file mode 100644 (file)
index 0000000..d402eab
--- /dev/null
@@ -0,0 +1,38 @@
+public class Foo {
+    public Foo() {
+       next=null;
+    }
+    Foo next;
+}
+
+public class Chase extends Thread {
+    Foo base;
+    public Chase(Foo b) {
+       base=b;
+    }
+    
+    public static void main(String [] argv) {
+       Chase c;
+       atomic {
+           Foo fold=global new Foo();
+           
+           for(int i=0;i<10000;i++) {
+               Foo f=global new Foo();
+               f.next=fold;
+               fold=f;
+           }
+           
+           c=global new Chase(fold);
+       }
+       c.start((128<<24)|(195<<16)|(175<<8)|71);
+       c.join();
+    }
+    
+    public void run() {
+        atomic {
+           Foo b=base;
+           while(b!=null)
+               b=b.next;
+        }
+    }
+}
diff --git a/Robust/src/Benchmarks/Prefetch/Chase/makefile b/Robust/src/Benchmarks/Prefetch/Chase/makefile
new file mode 100644 (file)
index 0000000..96dc971
--- /dev/null
@@ -0,0 +1,11 @@
+MAINCLASS=Chase
+SRC1=${MAINCLASS}.java
+FLAGS=-dsm -prefetch -optimize -debug -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS2=-dsm -optimize -debug -mainclass ${MAINCLASS} -trueprob 0.7
+default:
+       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
+       ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
+
+clean:
+       rm *.bin
+       rm -rf tmpbuilddirectory