commit 57e12e8a9e613b2b009ef80063aa318baed69aec Author: Thomas Preud'homme Date: Sat May 30 15:11:04 2009 +0200 Evaluation of Jikes RVM write barrier diff --git a/jikes_write_barrier/Makefile b/jikes_write_barrier/Makefile new file mode 100644 index 0000000..a08b6a8 --- /dev/null +++ b/jikes_write_barrier/Makefile @@ -0,0 +1,32 @@ +CC=gcc + +INCDIR=include +LIBDIR=lib +SRCDIR=src +BINDIR=bin +PAPILIBDIR=lib +PAPIINCDIR=include +LOCALDIR=$(HOME)/local + +default: barrier + +# TODO: Verify libpapihighlevel.so is uptodate (need a git module) +runbarrier: $(BINDIR)/lip6/jikesrvm/bench/Main.class $(BINDIR)/lip6/jikesrvm/bench/Cell.class + LD_LIBRARY_PATH=$(LOCALDIR)/$(LIBDIR) \ + rvm -cp $(BINDIR):$(LOCALDIR)/$(LIBDIR) \ + -Djava.library.path=$(LOCALDIR)/$(LIBDIR) \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main + +# TODO: Verify libpapihighlevel.so is uptodate (need a git module) +barrier: $(BINDIR)/lip6/jikesrvm/bench/Main.class + +$(BINDIR)/lip6/jikesrvm/bench/Main.class: $(SRCDIR)/lip6/jikesrvm/bench/Main.java \ + $(SRCDIR)/lip6/jikesrvm/bench/Cell.java + if [ ! -d $(BINDIR) ] ; then mkdir $(BINDIR) ; fi + javac -d $(BINDIR) -sourcepath $(SRCDIR) -classpath $(LOCALDIR)/$(PAPILIBDIR) \ + $(SRCDIR)/lip6/jikesrvm/bench/Main.java + +clean: + +distclean: clean + rm -rf $(BINDIR) diff --git a/jikes_write_barrier/logs/with_ints_with_barrier_bubble_sort b/jikes_write_barrier/logs/with_ints_with_barrier_bubble_sort new file mode 100644 index 0000000..e69de29 diff --git a/jikes_write_barrier/logs/with_refs_with_barrier_bubble_sort b/jikes_write_barrier/logs/with_refs_with_barrier_bubble_sort new file mode 100644 index 0000000..70fd2b3 --- /dev/null +++ b/jikes_write_barrier/logs/with_refs_with_barrier_bubble_sort @@ -0,0 +1,130 @@ +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 7856225986 +L1 data cache misses : 42593429 +Total cycles : 6260581022 +Instructions completed : 9057772365 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 12721192971 +L1 data cache misses : 41629055 +Total cycles : 9780090157 +Instructions completed : 12523198682 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 11474503806 +L1 data cache misses : 42830433 +Total cycles : 8951950593 +Instructions completed : 11484713722 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 9514624449 +L1 data cache misses : 34979841 +Total cycles : 7425253337 +Instructions completed : 10679950087 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 10442613966 +L1 data cache misses : 38535204 +Total cycles : 8110421986 +Instructions completed : 11022285865 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 9649352140 +L1 data cache misses : 38506204 +Total cycles : 7514358306 +Instructions completed : 10630749654 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 9289193839 +L1 data cache misses : 34984514 +Total cycles : 7221152833 +Instructions completed : 10373551902 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 9520818409 +L1 data cache misses : 34995452 +Total cycles : 7392555360 +Instructions completed : 10429643060 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 7859458194 +L1 data cache misses : 43621319 +Total cycles : 6264774698 +Instructions completed : 8993231118 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 8325810164 +L1 data cache misses : 43757821 +Total cycles : 6598387097 +Instructions completed : 9159926435 +---------------------------------------- diff --git a/jikes_write_barrier/logs/with_refs_without_barrier_bubble_sort b/jikes_write_barrier/logs/with_refs_without_barrier_bubble_sort new file mode 100644 index 0000000..dc4153a --- /dev/null +++ b/jikes_write_barrier/logs/with_refs_without_barrier_bubble_sort @@ -0,0 +1,130 @@ +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 4151666153 +L1 data cache misses : 40965208 +Total cycles : 3365296666 +Instructions completed : 4346635736 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 5628905554 +L1 data cache misses : 40795770 +Total cycles : 4399927753 +Instructions completed : 5564704630 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 4925354924 +L1 data cache misses : 40646528 +Total cycles : 3929536007 +Instructions completed : 4892870645 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 5066394247 +L1 data cache misses : 40725993 +Total cycles : 4029236766 +Instructions completed : 5150101365 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 4920983789 +L1 data cache misses : 40797101 +Total cycles : 3905129448 +Instructions completed : 4884638623 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 4196239158 +L1 data cache misses : 41002264 +Total cycles : 3403407318 +Instructions completed : 4390931430 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 5278645240 +L1 data cache misses : 40797406 +Total cycles : 4156122895 +Instructions completed : 5269032940 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 4900301670 +L1 data cache misses : 40987116 +Total cycles : 3923845888 +Instructions completed : 4930424189 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 5441093146 +L1 data cache misses : 40741140 +Total cycles : 4284213216 +Instructions completed : 5487664108 +---------------------------------------- +LD_LIBRARY_PATH=/home/robotux/local/lib:/home/robotux/Projects/lip6/papi/lib \ + rvm -cp barrier/bin -Djava.library.path=/home/robotux/Projects/lip6/papi/lib \ + -Xms2G -Xmx3G -X:processors=1 lip6.jikesrvm.bench.Main +External GC trigger +ctr: 129488718 +5 counters available +Micro benchmark results + +L1 data cache hits : 5560405377 +L1 data cache misses : 37920909 +Total cycles : 4370396702 +Instructions completed : 5637877960 +---------------------------------------- diff --git a/jikes_write_barrier/src/lip6/jikesrvm/bench/Cell.java b/jikes_write_barrier/src/lip6/jikesrvm/bench/Cell.java new file mode 100644 index 0000000..f24ed53 --- /dev/null +++ b/jikes_write_barrier/src/lip6/jikesrvm/bench/Cell.java @@ -0,0 +1,55 @@ +package lip6.jikesrvm.bench; + +public class Cell +{ + private static long ctr; + private int value; + private Cell next; + private Cell prev; + + static + { + ctr = 0; + } + + public Cell getNext() + { + return this.next; + } + + public void setNext(Cell next) + { + this.next = next; + } + + public Cell getPrev() + { + return this.prev; + } + + public void setPrev(Cell prev) + { + this.prev = prev; + } + + public int getValue() + { + return this.value; + } + + public Cell(int val) + { + this.value = val; + } + + public static void incCounter(int val) + { + ctr += val; + } + + public static long getCounter() + { + return ctr; + } +}; + diff --git a/jikes_write_barrier/src/lip6/jikesrvm/bench/Main.java b/jikes_write_barrier/src/lip6/jikesrvm/bench/Main.java new file mode 100644 index 0000000..41b6dce --- /dev/null +++ b/jikes_write_barrier/src/lip6/jikesrvm/bench/Main.java @@ -0,0 +1,98 @@ +package lip6.jikesrvm.bench; + +import java.util.Random; +import lip6.jikesrvm.bench.Cell; +import lip6.microbenchs.PapiHighLevel; + +public class Main +{ + private static final long NB_ELEM = 10000; + private static Random randomInt; // random int to put into the cells + private static Cell head; + + static + { + System.loadLibrary("papihighlevel"); + } + + public static void main(String args[]) + { + randomInt = new Random(424242424242L); + { + Cell oldCell, newCell; + + newCell = null; + head = new Cell(randomInt.nextInt()); + oldCell = head; + for (int i = 0; i < NB_ELEM - 1; i++) + { + if (i == NB_ELEM / 2) + Runtime.getRuntime().gc(); + newCell = new Cell(randomInt.nextInt()); + newCell.setPrev(oldCell); + oldCell.setNext(newCell); + oldCell = newCell; + } + newCell.setNext(head); + head.setPrev(newCell); + } + if (PapiHighLevel.initialize_papi() != 0) + { + System.err.println("Error while inizializing PAPI"); + java.lang.System.exit(1); + return; + } + bubbleSort(); + if (PapiHighLevel.print_results() != 0) + { + System.err.println("Error while getting results"); + java.lang.System.exit(2); + return; + } + } + + private static void bubbleSort() + { + Cell cell, nextCell; + + /* We suppose the list disordered */ + boolean ordered = false; + + /* We stop after NB_ELEM loop or if a loop has been done without inversion */ + for(int i = 0 ; (i < NB_ELEM) && !ordered; i++) + { + /* We suppose the list ordered */ + ordered = true; + + /* New tracing of the list: we start to examine the first 2 cells */ + cell = head; + nextCell = cell.getNext(); + for(int j = 1 ;j < NB_ELEM - i; j++) + { + /* If the 2 cells aren't ordered */ + if (nextCell.getValue() < cell.getValue()) + { + /* We invert the 2 cells */ + cell.getPrev().setNext(nextCell); + nextCell.getNext().setPrev(cell); + cell.setNext(nextCell.getNext()); + nextCell.setPrev(cell.getPrev()); + cell.setPrev(nextCell); + nextCell.setNext(cell); + Cell.incCounter(6); + + + /* We made an inversion: the list isn't ordered */ + ordered = false; + } + else + cell = nextCell; /* Get ready for the next loop: we make a one cell shift (1) */ + + /* Get ready for the next loop: we make a one cell shift (2) */ + nextCell = cell.getNext(); + } + } + System.out.println("ctr: " + Cell.getCounter()); + } +}; +