15 extern "C" void HPM_Init(
int);
16 extern "C" void HPM_Start(
char *label,
int);
17 extern "C" void HPM_Stop(
char *label,
int);
18 extern "C" void HPM_Print(
int,
int);
46 #include "TopoManager.h"
49 extern "C" void HPM_Init(
int);
50 extern "C" void HPM_Start(
char *label,
int);
51 extern "C" void HPM_Stop(
char *label,
int);
52 extern "C" void HPM_Print(
int,
int);
56 extern int TimeKeeperID;
57 extern std::vector <std::string> TimeKeeperNames;
59 static int keeperRegister(std::string name)
61 if(config.useTimeKeeper)
63 TimeKeeperNames.push_back(name);
64 return(TimeKeeperID++);
85 TopoManager *topoMgr =
new TopoManager();
87 topoMgr->rankToCoordinates(CkMyPe(),x,y,z,local_rank);
105 #if CMK_TRACE_ENABLED
119 CkPrintf(
"[%d] HPM_Init\n",CkMyPe());
120 HPM_Init(local_rank);
124 void startHPM(
char *
string){
128 CkPrintf(
"[%d] HPM_Start\n",CkMyPe());
129 HPM_Start(
string, local_rank);
132 void stopHPM(
char *
string)
137 CkPrintf(
"[%d] HPM_Stop\n", CkMyPe());
138 HPM_Stop(
string, local_rank);
139 HPMEndCounter=HPMCounter+1;
146 if(--HPMEndCounter==0)
149 CkPrintf(
"[%d] HPM_Print\n",CkMyPe());
150 HPM_Print(CkMyPe(), local_rank);
158 beginTime=
new double[TimeKeeperID+1];
160 void collectStart(CkReductionMsg *msg)
162 int phase= msg->getUserFlag();
163 CkAssert(phase<TimeKeeperID);
165 beginTime[phase] = *((
double *)msg->getData());
171 void collectEnd(CkReductionMsg *msg)
173 int phase = msg->getUserFlag();
174 CkAssert(phase<TimeKeeperID);
175 double endTime = *((
double *)msg->getData());
178 CkPrintf(
"Phase %s duration %.10g\n",TimeKeeperNames[phase].c_str(), endTime-beginTime[phase]);