From: adash Date: Sat, 25 Apr 2009 01:51:45 +0000 (+0000) Subject: generate stats in runtime. Use -stmstats option for compiling X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e3863c51f60af8a55b17fddf13b557ae1c3de541;p=IRC.git generate stats in runtime. Use -stmstats option for compiling --- diff --git a/Robust/src/Benchmarks/Prefetch/ManualPrefetch/2DConv/ConvolutionSizeC.java b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/2DConv/ConvolutionSizeC.java index 089bb89e..64ecea45 100644 --- a/Robust/src/Benchmarks/Prefetch/ManualPrefetch/2DConv/ConvolutionSizeC.java +++ b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/2DConv/ConvolutionSizeC.java @@ -66,7 +66,7 @@ public class Convolution extends Thread { int l=14; for(int i=x0;i=end) { int t=end-start-l-1; diff --git a/Robust/src/Benchmarks/SingleTM/KMeans/makefile b/Robust/src/Benchmarks/SingleTM/KMeans/makefile index d831827f..ea240770 100644 --- a/Robust/src/Benchmarks/SingleTM/KMeans/makefile +++ b/Robust/src/Benchmarks/SingleTM/KMeans/makefile @@ -6,7 +6,8 @@ SRC=${MAINCLASS}.java \ Common.java \ GlobalArgs.java \ ../../../ClassLibrary/JavaSTM/Barrier.java -FLAGS=-mainclass ${MAINCLASS} -singleTM -optimize -debug -dcopts -transstats -profile -joptimize -profile +FLAGS=-mainclass ${MAINCLASS} -singleTM -optimize -debug -dcopts -transstats -joptimize -stmdebug -stmstats + default: ../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC} diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index e3791fe6..86a790b1 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -241,6 +241,11 @@ public class BuildCode { } if (state.THREAD||state.DSM||state.SINGLETM) { outmethod.println("initializethreads();"); + outmethod.println("#ifdef STMSTATS \n"); + outmethod.println(" for(i=0; iaccessCount++; +#endif /* Insert into cache's lookup table */ STATUS(objcopy)=0; t_chashInsert(oid, &objcopy[1]); @@ -322,7 +336,12 @@ int traverseCache() { } else { oidwrlocked[numoidwrlocked++] = OID(header); transAbortProcess(oidwrlocked, numoidwrlocked); +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("WR Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -331,12 +350,17 @@ int traverseCache() { return TRANS_ABORT; } } else { /* cannot aquire lock */ +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif if(version == header->version) { /* versions match */ softabort=1; } else { transAbortProcess(oidwrlocked, numoidwrlocked); DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("WR Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -363,7 +387,12 @@ int traverseCache() { if(version != header->version) {/* versions do not match */ oidrdlocked[numoidrdlocked++] = OID(header); transAbortProcess(oidwrlocked, numoidwrlocked); +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("RD Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -372,12 +401,17 @@ int traverseCache() { return TRANS_ABORT; } } else { /* cannot aquire lock */ +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif //do increment as we didn't get lock if(version == header->version) { softabort=1; } else { transAbortProcess(oidwrlocked, numoidwrlocked); DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("RD Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -411,7 +445,7 @@ int traverseCache() { } /* ================================================== - * traverseCache + * alttraverseCache * - goes through the transaction cache and * - decides if a transaction should commit or abort * ================================================== @@ -455,7 +489,12 @@ int alttraverseCache() { } else { oidwrlocked[numoidwrlocked++] = OID(header); transAbortProcess(oidwrlocked, numoidwrlocked); +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("WR Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -469,7 +508,12 @@ int alttraverseCache() { softabort=1; } else { transAbortProcess(oidwrlocked, numoidwrlocked); +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("WR Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -492,7 +536,12 @@ int alttraverseCache() { if(header->lock>=0) { if(version != header->version) { transAbortProcess(oidwrlocked, numoidwrlocked); +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("RD Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); @@ -501,11 +550,16 @@ int alttraverseCache() { return TRANS_ABORT; } } else { /* cannot aquire lock */ +#ifdef STMSTATS + header->abortCount++; + (typesCausingAbort[TYPE(header)])++; +#endif if(version == header->version) { softabort=1; } else { transAbortProcess(oidwrlocked, numoidwrlocked); DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); + DEBUGSTMSTAT("RD Abort: Access Count: %u AbortCount: %u type: %u ver: %u \n", header->accessCount, header->abortCount, TYPE(header), header->version); if (c_numelements>=200) { free(oidrdlocked); free(oidrdversion); diff --git a/Robust/src/Runtime/STM/tm.h b/Robust/src/Runtime/STM/tm.h index c51ab03d..8579375e 100644 --- a/Robust/src/Runtime/STM/tm.h +++ b/Robust/src/Runtime/STM/tm.h @@ -43,6 +43,8 @@ typedef struct objheader { unsigned int version; unsigned int lock; + int abortCount; + int accessCount; } objheader_t; #define OID(x) \ @@ -129,6 +131,7 @@ extern int numTransAbort; extern int nSoftAbort; extern int nSoftAbortAbort; extern int nSoftAbortCommit; +extern int typesCausingAbort[]; #endif /* ================================ diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index f4188ac4..abbac360 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -113,6 +113,10 @@ void CALL11(___System______exit____I,int ___status___, int ___status___) { #ifdef STM printf("nSoftAbortCommit = %d\n", nSoftAbortCommit); printf("nSoftAbortAbort = %d\n", nSoftAbortAbort); + int i; + for(i=0; i