NAMD
ccsinterface.C
Go to the documentation of this file.
1 
7 #include "ccsinterface.h"
8 #include <conv-ccs.h>
9 
10 #if(CMK_CCS_AVAILABLE)
11 #include <stdlib.h>
12 
13 static int shouldReply=0;
14 static CcsDelayedReply theReply;
15 
16 extern "C" void CApplicationDepositNode0Data(char *data)
17 {
18  char *reply;
19  int len;
20 
21  if(shouldReply == 0) {
22  return;
23  }
24 
25  len = strlen(data) + 8; /* for the 'namdpr ' and '\0' */
26  reply = (char *)malloc(len * sizeof(char));
27  strcpy(reply, "namdpr ");
28  strcat(reply, data);
29 
30  /* Do the CcsSendReply */
31  CcsSendDelayedReply(theReply, strlen(reply) + 1, reply);
32  shouldReply=0;
33  free(reply);
34 }
35 
36 /*Called by clients on node 0 to ask for perf. data*/
37 void CApplicationRequestData(void)
38 {
39  shouldReply=1;
40  theReply=CcsDelayReply();
41 }
42 
43 void CApplicationInit(void)
44 {
45  CcsRegisterHandler("perf_app",(CmiHandler)CApplicationRequestData);
46 }
47 
48 #endif