[MOAB-dev] r4213 - MOAB/trunk/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue Oct 12 08:13:44 CDT 2010


Author: kraftche
Date: 2010-10-12 08:13:44 -0500 (Tue, 12 Oct 2010)
New Revision: 4213

Modified:
   MOAB/trunk/src/DebugOutput.cpp
   MOAB/trunk/src/DebugOutput.hpp
Log:
make time data in debug output easier to read

Modified: MOAB/trunk/src/DebugOutput.cpp
===================================================================
--- MOAB/trunk/src/DebugOutput.cpp	2010-10-12 13:12:51 UTC (rev 4212)
+++ MOAB/trunk/src/DebugOutput.cpp	2010-10-12 13:13:44 UTC (rev 4213)
@@ -53,43 +53,49 @@
 void CxxDebugStream::println( const char* pfx, const char* str )
   { outStr << pfx << str << std::endl; outStr.flush(); }
 
+#ifdef USE_MPI
+  #define CURTIME (MPI_Wtime())
+#else
+  #define CURTIME (clock()/(double)CLOCKS_PER_SEC)
+#endif
 
+
 DebugOutput::DebugOutput( DebugOutputStream* impl, unsigned verbosity )
-  : outputImpl(impl), mpiRank(-1), verbosityLimit(verbosity) 
+  : outputImpl(impl), mpiRank(-1), verbosityLimit(verbosity), initTime(CURTIME)
     { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( DebugOutputStream* impl, int rank, unsigned verbosity )
-  : outputImpl(impl), mpiRank(rank), verbosityLimit(verbosity)
+  : outputImpl(impl), mpiRank(rank), verbosityLimit(verbosity), initTime(CURTIME)
     { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( FILE* impl, unsigned verbosity )
   : outputImpl(new FILEDebugStream(impl)),
-    mpiRank(-1), verbosityLimit(verbosity) {}
+    mpiRank(-1), verbosityLimit(verbosity), initTime(CURTIME) {}
 DebugOutput::DebugOutput( FILE* impl, int rank, unsigned verbosity )
   : outputImpl(new FILEDebugStream(impl)),
-    mpiRank(rank), verbosityLimit(verbosity) {}
+    mpiRank(rank), verbosityLimit(verbosity), initTime(CURTIME) {}
 DebugOutput::DebugOutput( std::ostream& str, unsigned verbosity )
   : outputImpl(new CxxDebugStream(str)),
-    mpiRank(-1), verbosityLimit(verbosity) {}
+    mpiRank(-1), verbosityLimit(verbosity), initTime(CURTIME) {}
 DebugOutput::DebugOutput( std::ostream& str, int rank, unsigned verbosity )
   : outputImpl(new CxxDebugStream(str)),
-    mpiRank(rank), verbosityLimit(verbosity) {}
+    mpiRank(rank), verbosityLimit(verbosity), initTime(CURTIME) {}
 DebugOutput::DebugOutput( const char* pfx, DebugOutputStream* impl, unsigned verbosity )
-  : linePfx(pfx), outputImpl(impl), mpiRank(-1), verbosityLimit(verbosity) 
+  : linePfx(pfx), outputImpl(impl), mpiRank(-1), verbosityLimit(verbosity) , initTime(CURTIME)
   { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( const char* pfx, DebugOutputStream* impl, int rank, unsigned verbosity )
-  : linePfx(pfx), outputImpl(impl), mpiRank(rank), verbosityLimit(verbosity)
+  : linePfx(pfx), outputImpl(impl), mpiRank(rank), verbosityLimit(verbosity), initTime(CURTIME)
   { impl->referenceCount++; assert(impl->referenceCount > 1); }
 DebugOutput::DebugOutput( const char* pfx, FILE* impl, unsigned verbosity )
   : linePfx(pfx), outputImpl(new FILEDebugStream(impl)),
-    mpiRank(-1), verbosityLimit(verbosity) {}
+    mpiRank(-1), verbosityLimit(verbosity), initTime(CURTIME) {}


More information about the moab-dev mailing list