Example #1
0
static void CpdDebugCallAllocationTree(char *msg)
{
  int numNodes;
  int forPE;
  void *tree;
  if (CpdDebugGetAllocationTree == NULL) {
    CmiPrintf("Error> Invoked CpdDebugCalloAllocationTree but no function initialized.\nDid you forget to link in memory charmdebug?\n");
    CcsSendReply(0, NULL);
    return;
  }
  sscanf(msg+CmiMsgHeaderSizeBytes, "%d", &forPE);
  if (CmiMyPe() == forPE) CpvAccess(allocationTreeDelayedReply) = CcsDelayReply();
  if (forPE == -1 && CmiMyPe()==0) {
    CpvAccess(allocationTreeDelayedReply) = CcsDelayReply();
    CmiSetXHandler(msg, CpvAccess(CpdDebugCallAllocationTree_Index));
    CmiSetHandler(msg, _debugHandlerIdx);
    CmiSyncBroadcast(CmiMsgHeaderSizeBytes+strlen(msg+CmiMsgHeaderSizeBytes)+1, msg);
  }
  tree = CpdDebugGetAllocationTree(&numNodes);
  if (forPE == CmiMyPe()) CpdDebugReturnAllocationTree(tree);
  else if (forPE == -1) CmiReduceStruct(tree, CpdDebug_pupAllocationPoint, CpdDebug_MergeAllocationTree,
                                CpdDebugReturnAllocationTree, CpdDebug_deleteAllocationPoint);
  else CmiAbort("Received allocationTree request for another PE!");
  CmiFree(msg);
}
Example #2
0
static void CpdDebugCallMemStat(char *msg) {
  int forPE;
  void *stat;
  if (CpdDebugGetMemStat == NULL) {
    CmiPrintf("Error> Invoked CpdDebugCalloMemStat but no function initialized.\nDid you forget to link in memory charmdebug?\n");
    CcsSendReply(0, NULL);
    return;
  }
  sscanf(msg+CmiMsgHeaderSizeBytes, "%d", &forPE);
  if (CmiMyPe() == forPE) CpvAccess(memStatDelayedReply) = CcsDelayReply();
  if (forPE == -1 && CmiMyPe()==0) {
    CpvAccess(memStatDelayedReply) = CcsDelayReply();
    CmiSetXHandler(msg, CpvAccess(CpdDebugCallMemStat_Index));
    CmiSetHandler(msg, _debugHandlerIdx);
    CmiSyncBroadcast(CmiMsgHeaderSizeBytes+strlen(msg+CmiMsgHeaderSizeBytes)+1, msg);
  }
  stat = CpdDebugGetMemStat();
  if (forPE == CmiMyPe()) CpdDebugReturnMemStat(stat);
  else if (forPE == -1) CmiReduceStruct(stat, CpdDebug_pupMemStat, CpdDebug_mergeMemStat,
                                CpdDebugReturnMemStat, CpdDebug_deleteMemStat);
  else CmiAbort("Received allocationTree request for another PE!");
  CmiFree(msg);
}
Example #3
0
/*
 CCS handler "lvImage", taking a liveVizRequest, returning binary image data.
 A client requests an image from us.
 */
extern "C" void getImageHandler(char * msg)
{
  int msgLen=CmiSize(msg);
  char *buf=(char *)(msg+CmiMsgHeaderSizeBytes); msgLen-=CmiMsgHeaderSizeBytes;
  liveVizRequest o;
  PUP_toNetwork_unpack up(buf);
  o.pupNetwork(up);
  buf+=up.size(); msgLen-=up.size();
  int wid=o.wid,ht=o.ht;
  
  if (config.getVerbose(2))
    CmiPrintf("CCS getImage> Request for (%d x %d) or (0x%x x 0x%x) pixel image.\n",
	      wid,ht,wid,ht);
  if (msgLen<0) { 
    CmiError("liveViz0 getImageHandler Rejecting too-short image request\n");
    return;
  }
  
  o.replyToken = CcsDelayReply();
  liveViz0Get(o,buf,msgLen);
  CmiFree(msg); //Throw away the client's request
}
Example #4
0
void CpdSearchLeaks(char * msg) {
  LeakSearchInfo *info = (LeakSearchInfo *)(msg+CmiMsgHeaderSizeBytes);
  if (CmiMyPe() == info->pe || (info->pe == -1 && CmiMyPe() == 0)) {
#if CMK_64BIT
      info->begin_data = (char*)(
      (((CmiUInt8)ntohl(((int*)&info->begin_data)[0]))<<32) + ntohl(((int*)&info->begin_data)[1]));
      info->end_data = (char*)(
      (((CmiUInt8)ntohl(((int*)&info->end_data)[0]))<<32) + ntohl(((int*)&info->end_data)[1]));
      info->begin_bss = (char*)(
      (((CmiUInt8)ntohl(((int*)&info->begin_bss)[0]))<<32) + ntohl(((int*)&info->begin_bss)[1]));
      info->end_bss = (char*)(
      (((CmiUInt8)ntohl(((int*)&info->end_bss)[0]))<<32) + ntohl(((int*)&info->end_bss)[1]));
#else
      info->begin_data = (char*)(ntohl((int)info->begin_data));
      info->end_data = (char*)(ntohl((int)info->end_data));
      info->begin_bss = (char*)(ntohl((int)info->begin_bss));
      info->end_bss = (char*)(ntohl((int)info->end_bss));
#endif
    info->quick = ntohl(info->quick);
    info->pe = ntohl(info->pe);
    CpvAccess(leakSearchDelayedReply) = CcsDelayReply();
    if (info->pe == -1) {
      CmiSetXHandler(msg, CpvAccess(CpdSearchLeaks_Index));
      CmiSetHandler(msg, _debugHandlerIdx);
      CmiSyncBroadcast(CmiMsgHeaderSizeBytes+sizeof(LeakSearchInfo), msg);
    }
  }
  check_memory_leaks(info);
  if (info->pe == CmiMyPe()) CpdSearchLeaksDone(msg);
  else if (info->pe == -1) {
    void *reduceMsg = CmiAlloc(0);
    CmiSetHandler(reduceMsg, CpvAccess(CpdSearchLeaksDone_Index));
    CmiReduce(reduceMsg, CmiMsgHeaderSizeBytes, CmiReduceMergeFn_random);
    CmiFree(msg);
  }
  else CmiAbort("Received allocationTree request for another PE!");
}