Adding a controlPointTimingStamp() function in the control point framework.
authorIsaac Dooley <idooley2@illinois.edu>
Tue, 3 Nov 2009 21:55:37 +0000 (21:55 +0000)
committerIsaac Dooley <idooley2@illinois.edu>
Tue, 3 Nov 2009 21:55:37 +0000 (21:55 +0000)
src/ck-cp/controlPoints.C
src/ck-cp/controlPoints.h

index be8e75911314aec01bf1d3ab394caf37237dac59..241f0489add0e4f3d5890803c6eca77d57b35567 100644 (file)
@@ -754,6 +754,21 @@ void registerControlPointTiming(double time){
   controlPointManagerProxy.ckLocalBranch()->setTiming(time);
 }
 
+/// An interface callable by the application.
+void controlPointTimingStamp() {
+  CkAssert(CkMyPe() == 0);
+#if DEBUGPRINT>0
+  CkPrintf("Program registering its own timing with controlPointTimingStamp()\n", time);
+#endif
+  
+  static double prev_time = 0.0;
+  double t = CmiWallTimer();
+  double duration = t - prev_time;
+  prev_time = t;
+    
+  controlPointManagerProxy.ckLocalBranch()->setTiming(duration);
+}
+
 /// Shutdown the control point framework, writing data to disk if necessary
 extern "C" void controlPointShutdown(){
   if(CkMyPe() == 0){
index 4760baa899f7df490e5ec980e42905d7fd32b923..6fa92da7a548bfe34bb6e15c8ba8009ff88cf41f 100644 (file)
 
 
 void registerGranularityChangeCallback(CkCallback cb, bool frameworkShouldAdvancePhase);
+
+
 void registerControlPointTiming(double time);
 
+/// Called once each application step. Can be used instead of registerControlPointTiming()
+void controlPointTimingStamp();
 
 
 
@@ -432,7 +436,7 @@ public:
 
   // Find the fastest time from previous runs
   instrumentedPhase findBest(){
-    CkAssert(phases.size()>0);
+    CkAssert(phases.size()>1);
 
     double total_time = 0.0; // total for all times
     int total_count = 0;