From 990923ae86dc686ea342a8e9e9e46c1216e472f4 Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 15 Nov 2005 08:14:58 +0000 Subject: [PATCH] Time calculation is corrected. --- src/VISUGUI/VisuGUI.cxx | 11 +++++------ src/VISUGUI/VisuGUI_Timer.cxx | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) 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); -- 2.39.2