From fb36e9701a3140ca64a248a2e887c58c6f66db05 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 16 Apr 2009 06:46:30 +0000 Subject: [PATCH] debug support --- Robust/src/Runtime/STM/stm.c | 18 ++++++++++++++++++ Robust/src/buildscript | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index 89815bb6..658356aa 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -25,6 +25,12 @@ int nSoftAbortCommit = 0; int nSoftAbortAbort = 0; #endif +#ifdef STMDEBUG +#define DEBUGSTM(x...) printf(x); +#else +#define DEBUGSTM(x...) +#endif + /* ================================================== * stmStartup @@ -319,6 +325,7 @@ int traverseCache() { } else { oidwrlocked[numoidwrlocked++] = OID(header); transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } else { /* cannot aquire lock */ @@ -327,6 +334,7 @@ int traverseCache() { softabort=1; } else { transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } @@ -338,6 +346,7 @@ int traverseCache() { } else { oidrdlocked[numoidrdlocked++] = OID(header); transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } else { /* cannot aquire lock */ @@ -345,6 +354,7 @@ int traverseCache() { softabort=1; } else { transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } @@ -357,9 +367,11 @@ int traverseCache() { /* Decide the final response */ if (softabort) { transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("Softabort\n"); return TRANS_SOFT_ABORT; } else { transCommitProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("Commit\n"); return TRANS_COMMIT; } } @@ -406,6 +418,7 @@ int alttraverseCache() { } else { oidwrlocked[numoidwrlocked++] = OID(header); transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } else { /* cannot aquire lock */ @@ -414,6 +427,7 @@ int alttraverseCache() { softabort=1; } else { transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("WR Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } @@ -425,6 +439,7 @@ int alttraverseCache() { } else { oidrdlocked[numoidrdlocked++] = OID(header); transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } else { /* cannot aquire lock */ @@ -432,6 +447,7 @@ int alttraverseCache() { softabort=1; } else { transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("RD Abort: rd: %u wr: %u tot: %u type: %u ver: %u\n", numoidrdlocked, numoidwrlocked, c_numelements, TYPE(header), header->version); return TRANS_ABORT; } } @@ -443,9 +459,11 @@ int alttraverseCache() { /* Decide the final response */ if (softabort) { transAbortProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("Softabort\n"); return TRANS_SOFT_ABORT; } else { transCommitProcess(oidrdlocked, &numoidrdlocked, oidwrlocked, &numoidwrlocked); + DEBUGSTM("Commit\n"); return TRANS_COMMIT; } } diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 2a016acd..5c2f4a3f 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -4,6 +4,7 @@ printhelp() { echo -robustroot set up the ROBUSTROOT to directory other than default one echo -dsm distributed shared memory echo -singleTM single machine committing transactions +echo -stmdebug STM debug echo -abortreaders abort readers immediately echo -trueprob double - probabiltiy of true branch echo -dsmcaching -enable caching in dsm runtime @@ -153,6 +154,9 @@ then JAVAOPTS="$JAVAOPTS -singleTM" EXTRAOPTIONS="$EXTRAOPTIONS -DSTM" SINGLETM=true +elif [[ $1 = '-stmdebug' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG" elif [[ $1 = '-prefetch' ]] then JAVAOPTS="$JAVAOPTS -prefetch" -- 2.34.1