Added runtime option "+traceWarn" for warning messages from the tracing
authorChee Wai Lee <cheelee@illinois.edu>
Mon, 7 May 2007 20:40:59 +0000 (20:40 +0000)
committerChee Wai Lee <cheelee@illinois.edu>
Mon, 7 May 2007 20:40:59 +0000 (20:40 +0000)
framework to allow default scalability under non-error conditions.

src/ck-perf/trace-common.C
src/ck-perf/trace-common.h
src/ck-perf/trace-summary.C

index 59fd5c9cbaad5b2df2606bf58033714e4d85aab7..c483acd9b6abb93693c775c1aaafdafa97e9d388 100644 (file)
@@ -59,6 +59,7 @@ CkpvDeclare(double, traceInitCpuTime);
 CpvDeclare(int, traceOn);
 CkpvDeclare(int, traceOnPe);
 CkpvDeclare(char*, traceRoot);
+CkpvDeclare(bool, verbose);
 
 typedef void (*mTFP)();                   // function pointer for
 CpvDeclare(mTFP, machineTraceFuncPtr);    // machine user event
@@ -80,6 +81,7 @@ static void traceCommonInit(char **argv)
   CkpvAccess(traceInitCpuTime) = TRACE_CPUTIMER();
   CpvInitialize(int, traceOn);
   CpvInitialize(int, _traceCoreOn); //projector
+  CkpvInitialize(bool, verbose);
   CkpvInitialize(char*, traceRoot);
   CpvAccess(traceOn) = 0;
   CpvAccess(_traceCoreOn)=0; //projector
@@ -89,6 +91,11 @@ static void traceCommonInit(char **argv)
   char *root;
   char *temproot;
   char *temproot2;
+  if (CmiGetArgFlag(argv, "+traceWarn")) {
+    CkpvAccess(verbose) = true;
+  } else {
+    CkpvAccess(verbose) = false;
+  }
   if (CmiGetArgStringDesc(argv, "+traceroot", &temproot, "Directory to write trace files to")) {
     int i;
     // Trying to decide if the traceroot path is absolute or not. If it is not
index e0c06e50f9a6c38ec48ca5e5730303b4e4a67461..358f2c2ae90aa276bc59b3912e7e87142681aa71 100644 (file)
@@ -42,6 +42,7 @@
 
 CkpvExtern(int, CtrLogBufSize);
 CkpvExtern(char*, traceRoot);
+CkpvExtern(bool, verbose);
 CkpvExtern(double, traceInitTime);
 CkpvExtern(double, traceInitCpuTime);
 
@@ -61,6 +62,8 @@ inline double TraceCpuTimer() { return TRACE_CPUTIMER() - CkpvAccess(traceInitCp
 inline double TraceCpuTimer(double t) { return t - CkpvAccess(traceInitCpuTime); }
 #endif
 
+#define TRACE_WARN(msg) if (CkpvAccess(verbose)) CmiPrintf(msg)
+
 /** Tracing-specific registered Charm entities: */
 extern int _threadMsg, _threadChare, _threadEP;
 extern int _packMsg, _packChare, _packEP;
index 2f71658ae557ddbdefe792bab3b23dff9b6908d1..1b54c9c20c79a633f9aaac11b3c6c1b46d33d2be 100644 (file)
@@ -509,19 +509,18 @@ void TraceSummary::beginExecute(envelope *e)
 void TraceSummary::beginExecute(int event,int msgType,int ep,int srcPe, int mlen, CmiObjId *idx)
 {
   if (execEp != INVALIDEP) {
-    CmiPrintf("Warning: TraceSummary two consecutive BEGIN_PROCESSING!\n");
+    TRACE_WARN("Warning: TraceSummary two consecutive BEGIN_PROCESSING!\n");
     return;
   }
-
+  
   execEp=ep;
   double t = TraceTimer();
-//CmiPrintf("start: %f \n", start);
-
+  //CmiPrintf("start: %f \n", start);
+  
   start = t;
   double ts = binStart;
   // fill gaps
-  while ((ts = ts + CkpvAccess(binSize)) < t)
-  {
+  while ((ts = ts + CkpvAccess(binSize)) < t) {
      _logPool->add(bin, CkMyPe());
      bin=0.0;
      binStart = ts;
@@ -542,7 +541,7 @@ void TraceSummary::endExecute(void)
   }
 
   if (execEp == INVALIDEP) {
-    CmiPrintf("Warning: TraceSummary END_PROCESSING without BEGIN_PROCESSING!\n");
+    TRACE_WARN("Warning: TraceSummary END_PROCESSING without BEGIN_PROCESSING!\n");
     return;
   }