From: ouv Date: Tue, 15 Nov 2005 08:14:58 +0000 (+0000) Subject: Time calculation is corrected. X-Git-Tag: BR-D5-38-2003_D2005-24-11~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=990923ae86dc686ea342a8e9e9e46c1216e472f4;p=modules%2Fvisu.git Time calculation is corrected. --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 1b40603c..121e896e 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -42,6 +42,7 @@ #include #include #include +#include // 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 ); } } } diff --git a/src/VISUGUI/VisuGUI_Timer.cxx b/src/VISUGUI/VisuGUI_Timer.cxx index ce88bbfc..ca1eea96 100644 --- a/src/VISUGUI/VisuGUI_Timer.cxx +++ b/src/VISUGUI/VisuGUI_Timer.cxx @@ -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);