void pupSingleMessage(PUP::er &p, int curObj, void *msg) { beginItem(p,curObj); int isCharm=0; const char *type="Converse"; p.comment("name"); char name[128]; if (msg == (void*)-1) { type="Sentinel"; p((char*)type, strlen(type)); return; } #if ! CMK_BIGSIM_CHARM if (CmiGetHandler(msg)==_charmHandlerIdx) {isCharm=1; type="Local Charm";} if (CmiGetXHandler(msg)==_charmHandlerIdx) {isCharm=1; type="Network Charm";} #else isCharm=1; type="BG"; #endif if (curObj < 0) type="Conditional"; sprintf(name,"%s %d: %s (%d)","Message",curObj,type,CmiGetHandler(msg)); p(name, strlen(name)); if (isCharm) { /* charm message */ p.comment("charmMsg"); p.synchronize(PUP::sync_begin_object); envelope *env=(envelope *)msg; CkUnpackMessage(&env); //messages[curObj]=env; CpdPupMessage(p, EnvToUsr(env)); //CkPupMessage(p, &messages[curObj], 0); p.synchronize(PUP::sync_end_object); } }
virtual void pup(PUP::er &p, CpdListItemsRequest &req) { envelope *env = (envelope*)(((unsigned int)req.lo) + (((unsigned long)req.hi)<<32)+sizeof(CmiChunkHeader)); beginItem(p, 0); const char *type="Converse"; p.comment("name"); char name[128]; if (CmiGetHandler(env)==_charmHandlerIdx) {type="Local Charm";} if (CmiGetXHandler(env)==_charmHandlerIdx) {type="Network Charm";} sprintf(name,"%s 0: %s (%d)","Message",type,CmiGetHandler(env)); p(name, strlen(name)); p.comment("charmMsg"); p.synchronize(PUP::sync_begin_object); CpdPupMessage(p, EnvToUsr(env)); p.synchronize(PUP::sync_end_object); }
virtual void pup(PUP::er &p, CpdListItemsRequest &req) { int length; void ** messages; int curObj=0; void *msg; length = CdsFifo_Length((CdsFifo)(CpvAccess(conditionalQueue))); messages = CdsFifo_Enumerate(CpvAccess(conditionalQueue)); for (curObj=-length; curObj<0; curObj++) { void *msg = messages[length+curObj]; pupSingleMessage(p, curObj-1, msg); } delete[] messages; curObj = 0; length = CdsFifo_Length((CdsFifo)(CkpvAccess(debugQueue))); messages = CdsFifo_Enumerate(CkpvAccess(debugQueue)); if (CkpvAccess(lastBreakPointMsg) != NULL) { beginItem(p, -1); envelope *env=(envelope *)UsrToEnv(CkpvAccess(lastBreakPointMsg)); p.comment("name"); char *type=(char*)"Breakpoint"; p(type,strlen(type)); p.comment("charmMsg"); p.synchronize(PUP::sync_begin_object); CkUnpackMessage(&env); CpdPupMessage(p, EnvToUsr(env)); p.synchronize(PUP::sync_end_object); } for(curObj=req.lo; curObj<req.hi; curObj++) if ((curObj>=0) && (curObj<length)) { void *msg=messages[curObj]; /* converse message */ pupSingleMessage(p, curObj, msg); } delete[] messages; }
// Interpret data in a message in a user-friendly way. // Ignores most of the envelope fields used by CkPupMessage, // and instead concentrates on user data void CpdPupMessage(PUP::er &p, void *msg) { envelope *env=UsrToEnv(msg); //int wasPacked=env->isPacked(); int size=env->getTotalsize(); int prioBits=env->getPriobits(); int from=env->getSrcPe(); PUPn(from); //PUPn(wasPacked); PUPn(prioBits); int userSize=size-sizeof(envelope)-sizeof(int)*CkPriobitsToInts(prioBits); PUPn(userSize); int msgType = env->getMsgIdx(); PUPn(msgType); int envType = env->getMsgtype(); PUPn(envType); //p.synchronize(PUP::sync_last_system); int ep=CkMessageToEpIdx(msg); PUPn(ep); // Pup the information specific to this envelope type if (envType == ForArrayEltMsg || envType == ArrayEltInitMsg) { int arrID = env->getArrayMgr().idx; PUPn(arrID); CkArrayIndex &idx = env->getsetArrayIndex(); int nInts = idx.nInts; int dimension = idx.dimension; PUPn(nInts); PUPn(dimension); p.comment("index"); if (dimension >=4 && dimension <=6) { p((short int *)idx.index, dimension); } else { p(idx.index, nInts); } } else if (envType == ForNodeBocMsg || envType == ForBocMsg) { int groupID = env->getGroupNum().idx; PUPn(groupID); } else if (envType == BocInitMsg || envType == NodeBocInitMsg) { int groupID = env->getGroupNum().idx; PUPn(groupID); } else if (envType == NewVChareMsg || envType == ForVidMsg || envType == FillVidMsg) { p.comment("ptr"); void *ptr = env->getVidPtr(); pup_pointer(&p, &ptr); } else if (envType == ForChareMsg) { p.comment("ptr"); void *ptr = env->getObjPtr(); pup_pointer(&p, &ptr); } /* user data */ p.comment("data"); p.synchronize(PUP::sync_begin_object); if (_entryTable[ep]->messagePup!=NULL) _entryTable[ep]->messagePup(p,msg); else CkMessage::ckDebugPup(p,msg); p.synchronize(PUP::sync_end_object); }