Unchanged the function CthResumeNormalThread to its previous state (without record...
authorFilippo Gioachin <gioachin@uiuc.edu>
Wed, 10 Feb 2010 23:47:21 +0000 (17:47 -0600)
committerFilippo Gioachin <gioachin@uiuc.edu>
Wed, 10 Feb 2010 23:54:46 +0000 (17:54 -0600)
Added a new function (copy of CthResumeThread) that calls the record-replay mechanism.

src/ck-core/ck.C
src/ck-perf/trace-converse.c
src/conv-core/convcore.c

index 458bc43b6d071956017b65e06828d5381975e029..60deac0c90f0c66e7550eeebb220a7f56223bc06 100644 (file)
@@ -2148,7 +2148,7 @@ extern "C" void CkMessageDetailReplayDone(void *rep, double time) {
   ConverseExit();
 }
 
-extern "C" int CmiExecuteThreadResume(CthThreadToken *token) {
+static int CpdExecuteThreadResume(CthThreadToken *token) {
   CkCoreState *ck = CkpvAccess(_coreState);
   if (ck->watcher!=NULL) {
     return ck->watcher->processThread(token,ck);
@@ -2156,6 +2156,30 @@ extern "C" int CmiExecuteThreadResume(CthThreadToken *token) {
   return 1;
 }
 
+CpvCExtern(int, CthResumeNormalThreadIdx);
+extern "C" void CthResumeNormalThreadDebug(CthThreadToken* token)
+{
+  CthThread t = token->thread;
+
+  if(t == NULL){
+    free(token);
+    return;
+  }
+#ifndef CMK_OPTIMIZE
+#if ! CMK_TRACE_IN_CHARM
+  if(CpvAccess(traceOn))
+    CthTraceResume(t);
+/*    if(CpvAccess(_traceCoreOn)) 
+            resumeTraceCore();*/
+#endif
+#endif
+  
+  /* For Record/Replay debugging: need to notify the upper layer that we are resuming a thread */
+  if (CpdExecuteThreadResume(token)) {
+    CthResume(t);
+  }
+}
+
 #include "trace-common.h" /* For traceRoot and traceRootBaseLength */
 
 static FILE *openReplayFile(const char *prefix, const char *suffix, const char *permissions) {
@@ -2189,6 +2213,7 @@ void CkMessageWatcherInit(char **argv,CkCoreState *ck) {
     }
        if (CmiGetArgFlagDesc(argv,"+record","Record message processing order")) {
            CpdSetInitializeMemory(1);
+        CmiNumberHandler(CpvAccess(CthResumeNormalThreadIdx), (CmiHandler)CthResumeNormalThreadDebug);
                ck->addWatcher(new CkMessageRecorder(openReplayFile("ckreplay_",".log","w")));
        }
        if (CmiGetArgStringDesc(argv,"+replay-detail",&procs,"Replay the specified processors from recorded message content")) {
@@ -2208,6 +2233,7 @@ void CkMessageWatcherInit(char **argv,CkCoreState *ck) {
        }
     if (CmiGetArgFlagDesc(argv,"+replay","Replay recorded message stream") || forceReplay) {
         CpdSetInitializeMemory(1);
+        CmiNumberHandler(CpvAccess(CthResumeNormalThreadIdx), (CmiHandler)CthResumeNormalThreadDebug);
         ck->addWatcher(new CkMessageReplay(openReplayFile("ckreplay_",".log","r")));
     }
 }
index ba8752f490a8fda1c0f5b152f740efeee9bd4bf2..05b9233e31ba0badef27d9cd402abb4663d70f4f 100644 (file)
@@ -51,4 +51,3 @@ void traceUserSuppliedNote(char *note) {}
 /* This routine, included in Charm++ programs from init.C, needs to be present in converse as well.
    Here is a place where it gets included only in converse, and not in Charm++ (thus not generating conflicts). */
 void EmergencyExit(void) {}
-int CmiExecuteThreadResume(CthThreadToken *token) { return 1; }
index e90ec004c4d95deaea0ec0d8fefdbfcb40103f59..d9d112e803a7fad57b3f312e6158def462b2f261 100644 (file)
@@ -1661,7 +1661,7 @@ int handler;
 CpvStaticDeclare(CthThread, CthMainThread);
 CpvStaticDeclare(CthThread, CthSchedulingThread);
 CpvStaticDeclare(CthThread, CthSleepingStandins);
-CpvStaticDeclare(int      , CthResumeNormalThreadIdx);
+CpvDeclare(int      , CthResumeNormalThreadIdx);
 CpvStaticDeclare(int      , CthResumeSchedulingThreadIdx);
 
 
@@ -1696,6 +1696,7 @@ CthThread CthSuspendSchedulingThread()
   return succ;
 }
 
+/* Notice: For changes to the following function, make sure the function CthResumeNormalThreadDebug is also kept updated. */
 void CthResumeNormalThread(CthThreadToken* token)
 {
   CthThread t = token->thread;
@@ -1722,10 +1723,7 @@ void CthResumeNormalThread(CthThreadToken* token)
   CthPrintThdMagic(t);
   */
 
-  /* For Record/Replay debugging: need to notify the upper layer that we are resuming a thread */
-  if (CmiExecuteThreadResume(token)) {
-    CthResume(t);
-  }
+  CthResume(t);
 }
 
 void CthResumeSchedulingThread(CthThreadToken  *token)