fix a bug in traceSendMsgComm() which should only trace charm messages (no Converse...
authorGengbin Zheng <gzheng@illinois.edu>
Sat, 14 Jan 2012 05:33:49 +0000 (23:33 -0600)
committerGengbin Zheng <gzheng@illinois.edu>
Sat, 14 Jan 2012 05:33:49 +0000 (23:33 -0600)
src/ck-perf/trace-common.C
src/ck-perf/trace-projections.C

index 573ea891e01423a42266c2fd8c21b437f1ac42bf..241805e6fef940240310ce90ca474b1783bd7637 100644 (file)
@@ -10,7 +10,6 @@
 */
 /*@{*/
 
 */
 /*@{*/
 
-// cannot include charm++.h because trace-common.o is part of libconv-core.a
 #include "charm.h"
 #include "middle.h"
 #include "cklists.h"
 #include "charm.h"
 #include "middle.h"
 #include "cklists.h"
@@ -582,13 +581,16 @@ void traceAddThreadListeners(CthThread tid, envelope *e) {
   _TRACE_ONLY(CkpvAccess(_traces)->traceAddThreadListeners(tid, e));
 }
 
   _TRACE_ONLY(CkpvAccess(_traces)->traceAddThreadListeners(tid, e));
 }
 
-#if 0
+#if 1
 // helper functions
 // helper functions
+extern int _charmHandlerIdx;
+class CkCoreState;
+extern void _processHandler(void *, CkCoreState*);
 int CkIsCharmMessage(char *msg)
 {
 //CmiPrintf("getMsgtype: %d %d %d %d %d\n", ((envelope *)msg)->getMsgtype(), CmiGetHandler(msg), CmiGetXHandler(msg), _charmHandlerIdx, index_skipCldHandler);
   if ((CmiGetHandler(msg) == _charmHandlerIdx) &&
 int CkIsCharmMessage(char *msg)
 {
 //CmiPrintf("getMsgtype: %d %d %d %d %d\n", ((envelope *)msg)->getMsgtype(), CmiGetHandler(msg), CmiGetXHandler(msg), _charmHandlerIdx, index_skipCldHandler);
   if ((CmiGetHandler(msg) == _charmHandlerIdx) &&
-         (CmiGetHandlerFunction(msg) == (CmiHandler)_processHandler))
+         (CmiGetHandlerFunction(msg) == (CmiHandlerEx)_processHandler))
     return 1;
   if (CmiGetXHandler(msg) == _charmHandlerIdx) return 1;
   return 0;
     return 1;
   if (CmiGetXHandler(msg) == _charmHandlerIdx) return 1;
   return 0;
@@ -684,7 +686,7 @@ void traceEndCommOp(char *msg){
 extern "C"
 void traceSendMsgComm(char *msg){
 #if CMK_TRACE_ENABLED
 extern "C"
 void traceSendMsgComm(char *msg){
 #if CMK_TRACE_ENABLED
-  if (CpvAccess(traceOn) && CkpvAccess(_traces))
+  if (CpvAccess(traceOn) && CkpvAccess(_traces) && CkIsCharmMessage(msg))
     CkpvAccess(_traces)->creation(msg);
 #endif
 }
     CkpvAccess(_traces)->creation(msg);
 #endif
 }
index 8fcafedbeb2e4944fe711ce107b13069a66a219f..334e2e2c539fe4a98687e8f1ca1d133f02b6d1d1 100644 (file)
@@ -1256,12 +1256,11 @@ void TraceProjections::creation(char *msg)
 {
 #if CMK_SMP_TRACE_COMMTHREAD
        //This function is only called from a comm thread
 {
 #if CMK_SMP_TRACE_COMMTHREAD
        //This function is only called from a comm thread
-       //in SMP mode. So, it is possible the msg is not
-       //a charm msg that contains an envelope, ep idx.
+       //in SMP mode. 
+        // msg must be a charm message
        envelope *e = (envelope *)msg;
        int ep = e->getEpIdx();
        envelope *e = (envelope *)msg;
        int ep = e->getEpIdx();
-       int num = _entryTable.size();
-       if(ep<num && ep>=0 && _entryTable[ep]->traceEnabled)
+       if(_entryTable[ep]->traceEnabled)
                creation(e, ep, 1);
 #endif
 }
                creation(e, ep, 1);
 #endif
 }