Making sum detail tracing only get intialized once.
authorIsaac Dooley <idooley2@illinois.edu>
Thu, 21 May 2009 01:32:31 +0000 (01:32 +0000)
committerIsaac Dooley <idooley2@illinois.edu>
Thu, 21 May 2009 01:32:31 +0000 (01:32 +0000)
src/ck-perf/trace-summary.C
src/ck-perf/trace-summaryBOC.h

index a156ac2a3f42685fd47bf52e6cb7433ade287866..f6b0209d597e24d6c7e1af220538f939f030825f 100644 (file)
@@ -22,7 +22,7 @@
 #define TRACEON_EP     -3
 
 // 5 minutes of run before it'll fill up:
-#define DefaultBinCount      (1000*60*5
+#define DefaultBinCount      (1000*60*1
 
 CkpvStaticDeclare(TraceSummary*, _trace);
 static int _numEvents = 0;
@@ -930,30 +930,34 @@ void TraceSummary::fillData(double *buffer, double reqStartTime,
 /// for TraceSummaryBOC
 
 void TraceSummaryBOC::initCCS() {
-  // initializing CCS-based parameters on all processors
-  lastRequestedIndexBlock = 0;
-  indicesPerBlock = 1000;
-  collectionGranularity = 0.001; // time in seconds
-  nBufferedBins = 0;
+  if(firstTime){
+    CkPrintf("[%d] initCCS() called for first time\n", CkMyPe());
+    // initializing CCS-based parameters on all processors
+    lastRequestedIndexBlock = 0;
+    indicesPerBlock = 1000;
+    collectionGranularity = 0.001; // time in seconds
+    nBufferedBins = 0;
     
-  // initialize buffer, register CCS handler and start the collection
-  // pulse only on pe 0.
-  if (CkMyPe() == 0) { 
-    ccsBufferedData = new CkVec<double>();
+    // initialize buffer, register CCS handler and start the collection
+    // pulse only on pe 0.
+    if (CkMyPe() == 0) { 
+      ccsBufferedData = new CkVec<double>();
     
-    CProxy_TraceSummaryBOC sumProxy(traceSummaryGID);
-    CkPrintf("Trace Summary now listening in for CCS Client\n");
-    CcsRegisterHandler("CkPerfSummaryCcsClientCB", 
-                      CkCallback(CkIndex_TraceSummaryBOC::ccsRequestSummaryDouble(NULL), sumProxy[0]));
-    CcsRegisterHandler("CkPerfSummaryCcsClientCB uchar", 
-                      CkCallback(CkIndex_TraceSummaryBOC::ccsRequestSummaryUnsignedChar(NULL), sumProxy[0])); 
-    CcsRegisterHandler("CkPerfSumDetail compressed", 
-                      CkCallback(CkIndex_TraceSummaryBOC::ccsRequestSumDetailCompressed(NULL), sumProxy[0])); 
-
-    CkPrintf("[%d] Setting up periodic startCollectData callback\n", CkMyPe());
-    CcdCallOnConditionKeep(CcdPERIODIC_1second, startCollectData,
-                          (void *)this);
-    summaryCcsStreaming = CmiTrue;
+      CProxy_TraceSummaryBOC sumProxy(traceSummaryGID);
+      CkPrintf("Trace Summary now listening in for CCS Client\n");
+      CcsRegisterHandler("CkPerfSummaryCcsClientCB", 
+                        CkCallback(CkIndex_TraceSummaryBOC::ccsRequestSummaryDouble(NULL), sumProxy[0]));
+      CcsRegisterHandler("CkPerfSummaryCcsClientCB uchar", 
+                        CkCallback(CkIndex_TraceSummaryBOC::ccsRequestSummaryUnsignedChar(NULL), sumProxy[0])); 
+      CcsRegisterHandler("CkPerfSumDetail compressed", 
+                        CkCallback(CkIndex_TraceSummaryBOC::ccsRequestSumDetailCompressed(NULL), sumProxy[0])); 
+
+      CkPrintf("[%d] Setting up periodic startCollectData callback\n", CkMyPe());
+      CcdCallOnConditionKeep(CcdPERIODIC_1second, startCollectData,
+                            (void *)this);
+      summaryCcsStreaming = CmiTrue;
+    }
+    firstTime = false;
   }
 }
 
@@ -1178,7 +1182,8 @@ void TraceSummaryBOC::collectSumDetailData(double startTime, double binSize, int
 void TraceSummaryBOC::sumDetailDataCollected(CkReductionMsg *msg) {
   CkAssert(CkMyPe() == 0);
   CkPrintf("[%d] Reduction of SumDetail completed. Result stored in storedSumDetailResults deque(sizes=%d)\n", CkMyPe(), storedSumDetailResults.size() );
-  
+  fflush(stdout);
+
   //  printCompressedBuf(msg->getData());
   //  CkPrintf("Sanity Checking buffer before putting in storedSumDetailResults\n");
   compressedBuffer b(msg->getData());
index 7979e7fb7adc199b7c890ccda9de36bbdfde5c17..c5fe94e81429da31ede876d4c8627dc4b067b619 100644 (file)
@@ -27,6 +27,7 @@ private:
   int  nBins;
   int nTracedPEs;
 
+  bool firstTime; // used to make sure traceEnableCCS only has an effect the first time.
 
 public:
   /* CCS support variables */
@@ -41,7 +42,7 @@ public:
 
 public:
   TraceSummaryBOC(void): count(0), bins(NULL), nBins(0), 
-    nTracedPEs(0), nextBinIndexCcs(0) {};
+    nTracedPEs(0), nextBinIndexCcs(0), firstTime(true) {};
   TraceSummaryBOC(CkMigrateMessage *m):CBase_TraceSummaryBOC(m) {};
   void startSumOnly();
   void askSummary(int size);