Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / CONVERTOR / VISU_ConvertorUtils.cxx
index fcfb6f9539fd6073d6c80c8670240a4b90af7c91..a4d0f3bbc85d7b8b85e39fc76a5301e8b0afc147 100644 (file)
 //  Module : VISU
 
 #include "VISU_ConvertorUtils.hxx"
+
 #include <vtkUnstructuredGridWriter.h>
+#include <vtkTimerLog.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
 
-namespace VISU{
+namespace VISU
+{
 
   void 
   WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
@@ -40,4 +49,32 @@ namespace VISU{
     aWriter->Delete();
   }
 
+
+  TTimerLog
+  ::TTimerLog(int theIsDebug,
+             const std::string& theName):
+    myIsDebug(MYDEBUG + theIsDebug),
+    myTimerLog(vtkTimerLog::New()),
+    myPrefixPrinter(myIsDebug == 1),
+    myName(theName)
+  {
+    myCPUTime = myTimerLog->GetCPUTime();
+    BEGMSG(myIsDebug > 1,"{\n");
+  }
+
+  TTimerLog
+  ::~TTimerLog()
+  {
+    myCPUTime = myTimerLog->GetCPUTime() - myCPUTime;
+
+    if(myIsDebug > 1){
+      BEGMSG(myIsDebug,"} = "<<myCPUTime<<" secs ("<<myName<<")\n");
+    }else{
+      BEGMSG(myIsDebug,myName<<" takes "<<myCPUTime<<" secs\n");
+    }
+    
+    myTimerLog->Delete();
+    myTimerLog = NULL;
+  }
+
 }