From 751777a37e8ffa3c8ed0e52270711c74c66d94db Mon Sep 17 00:00:00 2001 From: adash Date: Sat, 29 Aug 2009 00:28:28 +0000 Subject: [PATCH] changes for modifying the microbenchmarks plot changes add improved debug statement measure time lapses using the "timestamp counter" processor register,rdtsc assembly instruction --- .../Prefetch/MicroBenchmarks/Makefile | 3 + .../src/Benchmarks/SingleTM/KMeans/makefile | 2 +- .../MicroBenchmarks/SingleObjectMod.java | 120 ++++++++++++++- .../SingleTM/MicroBenchmarks/data.plt | 34 +++-- .../SingleTM/MicroBenchmarks/makefile | 21 ++- .../SingleTM/MicroBenchmarks/run.sh | 141 ++++++++++++++++-- Robust/src/ClassLibrary/System.java | 12 ++ Robust/src/Runtime/Queue.c | 2 +- Robust/src/Runtime/STM/stm.c | 26 +++- Robust/src/Runtime/STM/tm.h | 1 - Robust/src/Runtime/runtime.c | 18 +++ Robust/src/buildscript | 8 + 12 files changed, 342 insertions(+), 46 deletions(-) diff --git a/Robust/src/Benchmarks/Prefetch/MicroBenchmarks/Makefile b/Robust/src/Benchmarks/Prefetch/MicroBenchmarks/Makefile index 038a009a..88e32bc3 100644 --- a/Robust/src/Benchmarks/Prefetch/MicroBenchmarks/Makefile +++ b/Robust/src/Benchmarks/Prefetch/MicroBenchmarks/Makefile @@ -25,6 +25,9 @@ FLAGS6 = -dsm -dsmcaching -optimize -mainclass ${MAINCLASS3} FLAGS7 = -dsm -prefetch -dsmcaching -optimize -mainclass ${MAINCLASS4} FLAGS8 = -dsm -dsmcaching -optimize -mainclass ${MAINCLASS4} +simple: + ../../../buildscript -dsm -dsmcaching -optimize -mainclass Simple -o Simple Simple.java + default: ../../../buildscript ${FLAGS2} -o ${NAME1}NP ${SRC1} cp ${NAME1}NP.bin ${NAME1}1NP.bin diff --git a/Robust/src/Benchmarks/SingleTM/KMeans/makefile b/Robust/src/Benchmarks/SingleTM/KMeans/makefile index 0277a56a..d273a11c 100644 --- a/Robust/src/Benchmarks/SingleTM/KMeans/makefile +++ b/Robust/src/Benchmarks/SingleTM/KMeans/makefile @@ -14,7 +14,7 @@ include ../common/Makefile.builds FLAGSSTATS=-mainclass ${MAINCLASS} -singleTM -optimize -debug -joptimize -32bit -abcclose -dcopts -transstats -arraypad -stmstats stmlock: - ../../../buildscript ${FLAGSSTATS} -o STATS${MAINCLASS} ${SRC} + ../../../buildscript ${FLAGSSTATS} -abrt 0 -o STATS${MAINCLASS} ${SRC} prep: diff --git a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/SingleObjectMod.java b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/SingleObjectMod.java index 775d0fe3..9b279a25 100644 --- a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/SingleObjectMod.java +++ b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/SingleObjectMod.java @@ -3,6 +3,7 @@ public class SingleObjectMod extends Thread { int arrysize; int loopsize; int lsize1, lsize2; + int prob; //prob to choose if short or long transaction int threadid; intwrapper[] mainobj; Random rand; @@ -11,12 +12,13 @@ public class SingleObjectMod extends Thread { } - public SingleObjectMod(int nthreads, int arrysize, int loopsize, int lsize1, int lsize2, int threadid, intwrapper[] mainobj, Random rand) { + public SingleObjectMod(int nthreads, int arrysize, int loopsize, int lsize1, int lsize2, int prob, int threadid, intwrapper[] mainobj, Random rand) { this.nthreads = nthreads; this.arrysize = arrysize; this.loopsize = loopsize; this.lsize1 = lsize1; this.lsize2 = lsize2; + this.prob = prob; this.threadid = threadid; this.mainobj = mainobj; this.rand = rand; @@ -48,9 +50,13 @@ public class SingleObjectMod extends Thread { if(i < args.length) { som.lsize2 = new Integer(args[i++]).intValue(); } + } else if(arg.equals("-p")) { + if(i < args.length) { + som.prob = new Integer(args[i++]).intValue(); + } } else { System.out.println("Incorrect argument"); - System.out.println("usage: ./SingleObjectMod -t -size -l -l1 -l2 \n"); + System.out.println("usage: ./SingleObjectMod -t -size -l -l1 -l2 -p \n"); } } } @@ -67,32 +73,122 @@ public class SingleObjectMod extends Thread { stop = loopsize; else stop = start + partitionSize; + LogTime[] lt = new LogTime[8*(stop-start)]; + for(int i = 0; i<8*(stop-start); i++) { + lt[i] = new LogTime(); + } + + int eventcount=0; //System.out.println("Start = " + start+ " stop= " + stop + " partitionSize= " + partitionSize+ " loopsize= " + loopsize + " lsize1= " + lsize1 + " lsize2= " + lsize2); + rand.random_seed(0); + int l1, l2; + //Time at Point1 + lt[eventcount].event = 1; + lt[eventcount++].time = System.getticks(); + for(int i = start; i < stop; i++) { + //Time at Point2 + lt[eventcount].event = 2; + lt[eventcount++].time = System.getticks(); + + int distribution = (int)(rand.random_generate() % 100); + + //90% long transactions + if(distribution < prob) { + l1=l2=lsize1; + } else { + //10% short transactions + l1=l2=lsize2; + } + + /* + //50% distribution + int l3= (int)(rand.random_generate() % 2); + if(l3==0) { + l1=l2=lsize2; + } + if(l3==1) { + l1=l2=lsize1; + } + */ + int count; + + //Time at point3 + lt[eventcount].event = 3; + lt[eventcount++].time = System.getticks(); + atomic { + //Time at Point4 + lt[eventcount].event = 4; + lt[eventcount++].time = System.getticks(); + index = (int)(rand.random_generate() % arrysize); // Do computation 1 - for(int j = 0; j> offset) & 0xFF); + } + // + // Debug + // System.println("Sending b[0]= "+ (char) b[0]); + // + return b; + } + + public static void main(String[] args) { SingleObjectMod som = new SingleObjectMod(); SingleObjectMod.parseCmdLine(args, som); som.mainobj = new intwrapper[som.arrysize]; + Random rand = new Random(); rand.random_alloc(); @@ -105,7 +201,7 @@ public class SingleObjectMod extends Thread { SingleObjectMod[] mysom = new SingleObjectMod[nthreads]; for(int i = 0; i < nthreads; i++) { - mysom[i] = new SingleObjectMod(nthreads, som.arrysize, som.loopsize, som.lsize1, som.lsize2, i, som.mainobj, rand); + mysom[i] = new SingleObjectMod(nthreads, som.arrysize, som.loopsize, som.lsize1, som.lsize2, som.prob, i, som.mainobj, rand); } for(int i = 0; i < nthreads; i++) { @@ -120,3 +216,13 @@ public class SingleObjectMod extends Thread { System.exit(0); } } + +public class LogTime { + public int event; + public long time; + + public LogTime() { + event = 0; + time = 0; + } +} diff --git a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/data.plt b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/data.plt index 452a396d..cebc32d1 100644 --- a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/data.plt +++ b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/data.plt @@ -6,23 +6,24 @@ set grid ytics ##### Plot Execution time for 4 threads ######## -set title "Execution times for Microbenchmark numthreads= 4" -set output "ExecTime4.eps" -set ylabel 'Time in secs' -set xlabel 'Desired abort rate for benchmark in %' -set yrange [0.43:0.47] -set style line 1 lt 2 lw 2 pt 3 ps 0.5 -plot 0.46 title 'No-lock base time' linewidth 2, \ - "run4.data" using 1:2 title 'exec time' linetype 3 linewidth 2 +#set title "Execution times for Microbenchmark numthreads= 4" +#set output "ExecTime4.eps" +#set ylabel 'Time in secs' +#set xlabel 'Desired abort rate for benchmark in %' +#set yrange [0.30:0.40] +#set style line 1 lt 2 lw 2 pt 3 ps 0.5 +#plot 0.37 title 'No-lock base time' linewidth 2, \ +# "run4.data" using 1:2 title 'exec time' linetype 3 linewidth 2 #pause -1 ##### Plot Target abort rate vs observed rate for 4 threads ######## -set title "Abort Rates for Microbenchmark(fudge factor= 3, numthreads= 4)" -set output "AbortRate4.eps" -set ylabel 'Observed Abort rate in %(numabort+numsoftabort)/numcommit' -set xlabel 'Desired abort rate for benchmark in %' -plot "run4.txt" using 1:2 with impulse title 'Base abort rate' linewidth 2, \ - "run4.data" using 1:3 title 'abort rate' linetype 3 linewidth 2 +#set title "Abort Rates for Microbenchmark(fudge factor= 3, numthreads= 4)" +#set output "AbortRate4.eps" +#set ylabel 'Observed Abort rate in %(numabort+numsoftabort)/numcommit' +#set xlabel 'Desired abort rate for benchmark in %' +#set yrange [0:70] +#plot "run4.txt" using 1:2 with impulse title 'Base abort rate' linewidth 2, \ +# "run4.data" using 1:3 title 'abort rate' linetype 3 linewidth 2 #pause -1 ##### Plot Execution time for 8 threads ######## @@ -30,9 +31,9 @@ set title "Execution times for Microbenchmark numthreads= 8" set output "ExecTime8.eps" set ylabel 'Time in secs' set xlabel 'Desired abort rate for benchmark in %' -set yrange [1.28:1.38] +set yrange [0:3.5] set style line 1 lt 2 lw 2 pt 3 ps 0.5 -plot 1.35 title 'No-lock base time' linewidth 2, \ +plot 2.98 title 'No-lock base time' linewidth 2, \ "run8.data" using 1:2 title 'exec time' linetype 3 linewidth 2 #pause -1 @@ -41,6 +42,7 @@ set title "Abort Rates for Microbenchmark(fudge factor= 3, numthreads= 8)" set output "AbortRate8.eps" set ylabel 'Observed Abort rate in %(numabort+numsoftabort)/numcommit' set xlabel 'Desired abort rate for benchmark in %' +set yrange [0:70] plot "run8.txt" using 1:2 with impulse title 'Base abort rate' linewidth 2, \ "run8.data" using 1:3 title 'abort rate' linetype 3 linewidth 2 diff --git a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/makefile b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/makefile index 8d0df353..e218f6c8 100644 --- a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/makefile +++ b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/makefile @@ -3,10 +3,27 @@ SRC=${MAINCLASS}.java \ ../KMeans/Random.java \ ../../../ClassLibrary/intwrapper.java -FLAGSSTATS=-stmstats -mainclass ${MAINCLASS} -singleTM -optimize -debug -joptimize -64bit -abcclose -dcopts -transstats -arraypad +FLAGSSTATS=-stmstats -mainclass ${MAINCLASS} -singleTM -optimize -debug -joptimize -64bit -abcclose -dcopts -transstats -arraypad +FLAGS=-mainclass ${MAINCLASS} -singleTM -nooptimize -debug -joptimize -64bit -abcclose -dcopts -transstats -arraypad + +base: + ../../../buildscript ${FLAGS} ${SRC} -o STATS${MAINCLASS}NoLockBase stmlock: - ../../../buildscript ${FLAGSSTATS} ${SRC} -o STATS${MAINCLASS} + ../../../buildscript ${FLAGSSTATS} -abrt 10 ${SRC} -o STATS${MAINCLASS}10 + ../../../buildscript ${FLAGSSTATS} -abrt 20 ${SRC} -o STATS${MAINCLASS}20 + ../../../buildscript ${FLAGSSTATS} -abrt 30 ${SRC} -o STATS${MAINCLASS}30 + ../../../buildscript ${FLAGSSTATS} -abrt 40 ${SRC} -o STATS${MAINCLASS}40 + ../../../buildscript ${FLAGSSTATS} -abrt 45 ${SRC} -o STATS${MAINCLASS}45 + ../../../buildscript ${FLAGSSTATS} -abrt 50 ${SRC} -o STATS${MAINCLASS}50 + ../../../buildscript ${FLAGSSTATS} -abrt 55 ${SRC} -o STATS${MAINCLASS}55 + ../../../buildscript ${FLAGSSTATS} -abrt 60 ${SRC} -o STATS${MAINCLASS}60 + ../../../buildscript ${FLAGSSTATS} -abrt 65 ${SRC} -o STATS${MAINCLASS}65 + ../../../buildscript ${FLAGSSTATS} -abrt 70 ${SRC} -o STATS${MAINCLASS}70 + ../../../buildscript ${FLAGSSTATS} -abrt 80 ${SRC} -o STATS${MAINCLASS}80 + ../../../buildscript ${FLAGSSTATS} -abrt 90 ${SRC} -o STATS${MAINCLASS}90 + ../../../buildscript ${FLAGSSTATS} -abrt 100 ${SRC} -o STATS${MAINCLASS}100 + clean: rm -rf tmpbuilddirectory diff --git a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/run.sh b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/run.sh index 8929ef7d..328b8eef 100755 --- a/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/run.sh +++ b/Robust/src/Benchmarks/SingleTM/MicroBenchmarks/run.sh @@ -1,19 +1,130 @@ #!/bin/sh +function run { + echo ------------Running $1 -------------------- + for file in `ls STATS*` + do + num=`echo $file | tr -d ".bin" | tr -d "STATSSingleObjectMod"` + echo $num + /usr/bin/time -f "%e" -o /tmp/time ./$file $1 -o > /tmp/out + t=`cat /tmp/time` + nTcommit=`grep TransCommit /tmp/out | awk '{print $3}'` + nTabort=`grep TransAbort /tmp/out | awk '{print $3}'` + nSftabort=`grep 'nSoftAbort ' /tmp/out | awk '{print $3}'` + p=`echo "$nTabort $nSftabort $nTcommit" | awk '{print (($1+$2)/($3))*100}'` + echo "$num $t $p $file" >> runlog/$2 + done +} + +echo "--------- Clean old files ----------" +#rm runlog/*.txt +#make base +#make stmlock +ARGS1="-t 8 -size 4 -l 100000 -l1 20000 -l2 40000" +ARGS2="-t 8 -size 4 -l 100000 -l1 10000 -l2 20000" +ARGS3="-t 8 -size 4 -l 100000 -l1 5000 -l2 10000" +ARGS4="-t 8 -size 4 -l 100000 -l1 2500 -l2 5000" +ARGS5="-t 8 -size 4 -l 100000 -l1 40000 -l2 20000" +ARGS6="-t 8 -size 4 -l 100000 -l1 10000 -l2 5000" +ARGS7="-t 8 -size 4 -l 100000 -l1 20000 -l2 10000" +ARGS8="-t 1 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS38="-t 2 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS48="-t 4 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS58="-t 8 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS68="-t 10 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS78="-t 12 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS88="-t 16 -size 1 -l 100000 -l1 10000 -l2 10000" +ARGS9="-t 8 -size 4 -l 100000 -l1 0 -l2 0" +ARGS10="-t 8 -size 1 -l 100000 -l1 40000 -l2 40000 -p 90" +ARGS11="-t 8 -size 1 -l 100000 -l1 10000 -l2 10000 -p 90" +ARGS12="-t 8 -size 1 -l 100000 -l1 40000 -l2 10000 -p 90" +ARGS13="-t 8 -size 4 -l 100000 -l1 10000 -l2 40000" +ARGS14="-t 8 -size 4 -l 100000 -l1 10000 -l2 60000" +ARGS15="-t 8 -size 4 -l 100000 -l1 80000 -l2 10000" +ARGS16="-t 8 -size 4 -l 100000 -l1 70000 -l2 10000" +ARGS17="-t 8 -size 4 -l 100000 -l1 70000 -l2 70000" +ARGS18="-t 1 -size 1 -l 100000 -l1 1 -l2 1" +ARGS19="-t 2 -size 1 -l 100000 -l1 1 -l2 1" +ARGS20="-t 4 -size 1 -l 100000 -l1 1 -l2 1" +ARGS21="-t 8 -size 1 -l 100000 -l1 1 -l2 1" +ARGS22="-t 12 -size 1 -l 100000 -l1 1 -l2 1" +ARGS23="-t 16 -size 1 -l 100000 -l1 1 -l2 1" +ARGS24="-t 1 -size 1 -l 1 -l1 1 -l2 1" +ARGS25="-t 1 -size 1 -l 1 -l1 0 -l2 0" +ARGS26="-t 1 -size 1 -l 100000 -l1 0 -l2 0" +ARGS27="-t 2 -size 1 -l 100000 -l1 0 -l2 0" +ARGS28="-t 4 -size 1 -l 100000 -l1 0 -l2 0" +ARGS29="-t 8 -size 1 -l 100000 -l1 0 -l2 0" + +#run "$ARGS1" l1_20000_l2_40000.txt +#run "$ARGS2" l1_10000_l2_20000.txt +#run "$ARGS3" l1_5000_l2_10000.txt +#run "$ARGS4" l1_2500_l2_5000.txt +#run "$ARGS5" l1_40000_l2_20000.txt +#run "$ARGS6" l1_10000_l2_5000.txt +#run "$ARGS7" l1_20000_l2_10000.txt +#run "$ARGS8" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS38" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS48" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS58" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS68" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS78" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS88" lockunlock_l_100000_l1_10000_l2_10000.txt +#run "$ARGS9" l1_0_l2_0.txt +run "$ARGS10" l1_40000_l2_40000.txt +run "$ARGS11" l1_10000_l2_10000.txt +run "$ARGS12" l1_40000_l2_10000.txt +#run "$ARGS13" l1_10000_l2_40000.txt +#run "$ARGS14" l1_10000_l2_60000.txt +#run "$ARGS15" l1_10000_l2_80000.txt +#run "$ARGS16" l1_10000_l2_70000.txt +#run "$ARGS17" l1_70000_l2_70000.txt +#run "$ARGS18" t_1_l1_1_l2_1.txt +#run "$ARGS19" t_2_l1_1_l2_1.txt +#run "$ARGS20" t_4_l1_1_l2_1.txt +#run "$ARGS21" t_8_l1_1_l2_1.txt +#run "$ARGS22" t_12_l1_1_l2_1.txt +#run "$ARGS23" t_16_l1_1_l2_1.txt +#run "$ARGS24" t_1_l1_1_l2_1.txt +#run "$ARGS25" t_1_l1_0_l2_0.txt +#run "$ARGS26" l_100000_l1_0_l2_0.txt +#run "$ARGS27" l_100000_l1_0_l2_0.txt +#run "$ARGS28" l_100000_l1_0_l2_0.txt +#run "$ARGS29" l_100000_l1_0_l2_0.txt + + +## --------- Cut the first line from the .txt files generated above and plot them --------- +#for file in `ls runlog/*.plt` +#do +#basetime=`cat $file | grep "NLkBas" | cut -f2 -d" "` +# gnuplot $file +#done + #high contention 4 threads -ARGS4="-t 4 -size 5 -l 10000 -l1 100 -l2 50000" +#ARGS4="-t 4 -size 5 -l 10000 -l1 100 -l2 50000" +#ARGS4="-t 4 -size 4 -l 10000 -l1 10000 -l2 10000" #44.1% abort #high contention 8 threads -ARGS8="-t 8 -size 10 -l 100000 -l1 100 -l2 50000" -for file in `ls STATS*` -do - num=`echo $file | tr -d ".bin" | tr -d "STATSSingleObjectMod"` - echo $num -# /usr/bin/time -f "%e" -o /tmp/time ./$file $ARGS4 -o > /tmp/out - /usr/bin/time -f "%e" -o /tmp/time ./$file $ARGS8 -o > /tmp/out - t=`cat /tmp/time` - nTcommit=`grep TransCommit /tmp/out | awk '{print $3}'` - nTabort=`grep TransAbort /tmp/out | awk '{print $3}'` - nSftabort=`grep 'nSoftAbort ' /tmp/out | awk '{print $3}'` - p=`echo "$nTabort $nSftabort $nTcommit" | awk '{print (($1+$2)/$3)*100}'` - echo "$num $t $p $file" >> data.file -done +#ARGS8="-t 8 -size 4 -l 100000 -l1 0 -l2 0" +#ARGS8="-t 8 -size 4 -l 100000 -l1 20000 -l2 40000" +#-t 8 -size 4 -l 100000 -l1 10000 -l2 20000" +#-t 8 -size 4 -l 100000 -l1 5000 -l2 10000" +#-t 8 -size 4 -l 100000 -l1 2500 -l2 5000" +#-t 8 -size 4 -l 100000 -l1 40000 -l2 20000" +#-t 8 -size 4 -l 100000 -l1 10000 -l2 5000" +#-t 8 -size 4 -l 100000 -l1 20000 -l2 10000" +#-t 8 -size 4 -l 100000 -l1 10000 -l2 10000" +#ARGS8="-t 8 -size 4 -l 10000 -l1 0 -l2 0" +#ARGS8="-t 8 -size 6 -l 10000 -l1 5000 -l2 5000" #55.79% abort +#for file in `ls STATS*` +#do +# num=`echo $file | tr -d ".bin" | tr -d "STATSSingleObjectMod"` +# echo $num +## /usr/bin/time -f "%e" -o /tmp/time ./$file $ARGS4 -o > /tmp/out +# /usr/bin/time -f "%e" -o /tmp/time ./$file $1 -o > /tmp/out +# t=`cat /tmp/time` +# nTcommit=`grep TransCommit /tmp/out | awk '{print $3}'` +# nTabort=`grep TransAbort /tmp/out | awk '{print $3}'` +# nSftabort=`grep 'nSoftAbort ' /tmp/out | awk '{print $3}'` +# p=`echo "$nTabort $nSftabort $nTcommit" | awk '{print (($1+$2)/($1+$2+$3))*100}'` +# echo "$num $t $p $file" >> data.file +#done diff --git a/Robust/src/ClassLibrary/System.java b/Robust/src/ClassLibrary/System.java index 1aa3d089..75a01479 100644 --- a/Robust/src/ClassLibrary/System.java +++ b/Robust/src/ClassLibrary/System.java @@ -5,6 +5,10 @@ public class System { } public static native long currentTimeMillis(); + + public static native long microTimes(); + + public static native long getticks(); public static native void printString(String s); @@ -24,6 +28,10 @@ public class System { System.printString(""+o+"\n"); } + public static void println(long o) { + System.printString(""+o+"\n"); + } + public static void print(String s) { System.printString(s); } @@ -40,6 +48,10 @@ public class System { System.printString(""+o); } + public static void print(long o) { + System.printString(""+o); + } + public static void error() { System.printString("Error (Use Breakpoint on ___System______error method for more information!)\n"); } diff --git a/Robust/src/Runtime/Queue.c b/Robust/src/Runtime/Queue.c index 2093d217..192b9ca3 100644 --- a/Robust/src/Runtime/Queue.c +++ b/Robust/src/Runtime/Queue.c @@ -158,7 +158,7 @@ void clearQueue(struct Queue * queue) { item=next; } queue->head=queue->tail=NULL; - return NULL; + return; } #ifdef DEBUG_QUEUE diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index f5c9fcc8..c209fb4d 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -37,6 +37,16 @@ int nSoftAbortAbort = 0; #endif #ifdef STMSTATS +int timeInMS () +{ + struct timeval t; + + gettimeofday(&t, NULL); + return ( + (int)t.tv_sec * 1000000 + + (int)t.tv_usec + ); +} /* Thread variable for locking/unlocking */ __thread threadrec_t *trec; __thread struct objlist * lockedobjs; @@ -73,7 +83,13 @@ INLINE void getTransSize(objheader_t *header , int *isObjTypeTraverse) { #ifdef STMDEBUG #define DEBUGSTM(x...) printf(x); #else -#define DEBUGSTM(x...) +#define DEBUGSTM(x...); +#endif + +#ifdef STATDEBUG +#define DEBUGSTATS(x...) printf(x); +#else +#define DEBUGSTATS(x...); #endif //#ifdef FASTMEMCPY @@ -122,7 +138,7 @@ void ABORTCOUNT(objheader_t * x) { DEBUGSTM("ABORTSTATS: oid= %x, type= %2d, transAbortProb= %2.2f, ObjAbortProb= %2.2f, Typenumaccess= %3d, avgtranssize = %2d, ObjabortCount= %2d, ObjaccessCount= %3d\n", OID(x), TYPE(x), transAbortProbForObj, ObjAbortProb, typesCausingAbort[TYPE(x)].numaccess, avgTransSize, x->abortCount, x->accessCount); /* Condition for locking objects */ if (((ObjAbortProb*100) >= transAbortProbForObj) && (x->riskyflag != 1)) { - DEBUGSTM("AFTER LOCK ABORTSTATS: oid= %x, type= %2d, transAbortProb= %2.2f, ObjAbortProb= %2.2f, Typenumaccess= %3d, avgtranssize = %2d, ObjabortCount= %2d, ObjaccessCount= %3d\n", OID(x), TYPE(x), transAbortProbForObj, ObjAbortProb, typesCausingAbort[TYPE(x)].numaccess, avgTransSize, x->abortCount, x->accessCount); + DEBUGSTATS("AFTER LOCK ABORTSTATS: oid= %x, type= %2d, transAbortProb= %2.2f, ObjAbortProb= %2.2f, Typenumaccess= %3d, avgtranssize = %2d, ObjabortCount= %2d, ObjaccessCount= %3d\n", OID(x), TYPE(x), transAbortProbForObj, ObjAbortProb, typesCausingAbort[TYPE(x)].numaccess, avgTransSize, x->abortCount, x->accessCount); //makes riskflag sticky pthread_mutex_lock(&lockedobjstore); if (objlockscope->offset___value___; int i; diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 66986b44..a8565e72 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -193,6 +193,9 @@ EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET" elif [[ $1 = '-stmdebug' ]] then EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG" +elif [[ $1 = '-statdebug' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -DSTATDEBUG" elif [[ $1 = '-stmstats' ]] then EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS" @@ -382,6 +385,11 @@ elif [[ $1 = '-outputdir' ]] then JAVAOPTS="$JAVAOPTS -outputdir $2" shift +elif [[ $1 = '-abrt' ]] +then +ABRT="PERCENT_ALLOWED_ABORT=$2" +EXTRAOPTIONS="$EXTRAOPTIONS -D$ABRT" +shift else SRCFILES="$SRCFILES $1" fi -- 2.34.1