]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Time calculation is corrected.
authorouv <ouv@opencascade.com>
Tue, 15 Nov 2005 08:14:58 +0000 (08:14 +0000)
committerouv <ouv@opencascade.com>
Tue, 15 Nov 2005 08:14:58 +0000 (08:14 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Timer.cxx

index 1b40603c3f204eba12ec7c092ce85ac10a802033..121e896e5bd06fc77054a1fa71fd4a3a264148af 100644 (file)
@@ -42,6 +42,7 @@
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkActorCollection.h>
+#include <vtkTimerLog.h>
 
 // SALOME Includes
 #include "SALOME_LifeCycleCORBA.hxx"
@@ -155,14 +156,10 @@ VisuGUI::~VisuGUI()
 {
 }
 
-
 void
 VisuGUI::
 OnImportFromFile()
 {
-  VisuGUI_Timer aTimer;
-  aTimer.Start();
-
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
   CheckLock(GetCStudy(GetAppStudy(this)));
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
@@ -179,6 +176,7 @@ OnImportFromFile()
                               true);
   if(aFileInfo.exists()) {
     application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
+    double initialTime = vtkTimerLog::GetCPUTime();
 
     VISU::Result_var aResult;
     bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
@@ -207,8 +205,9 @@ OnImportFromFile()
                              tr("BUT_OK"));
     }else{
       UpdateObjBrowser(this);
-      application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") +
-                            " in " + aTimer.GetTime() + " seconds", -1 );
+      application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") + " in " + 
+                            QString::number( vtkTimerLog::GetCPUTime() - initialTime ) + 
+                            " seconds", -1 );
     }
   }
 }
index ce88bbfc7b3324aabbaa316d34b840a3f85e4d33..ca1eea96bdb3c617901aab3b59bcb64bf7118961 100644 (file)
@@ -74,8 +74,9 @@ void VisuGUI_Timer::Stop()
     int diffr_sys  = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
     gettimeofday(RefToCurrentTimeB,tz);
 
-    Cumul_user += (double) diffr_user / CLK_TCK ;
-    Cumul_sys  += (double) diffr_sys  / CLK_TCK ;
+    static long aCLK_TCK=sysconf(_SC_CLK_TCK);
+    Cumul_user += (double) diffr_user / aCLK_TCK ;
+    Cumul_sys  += (double) diffr_sys  / aCLK_TCK ;
 #else
     SYSTEMTIME st;
     GetSystemTime(&st);