#include "VisuGUI_ActionsDef.h"
+#include "VisuGUI_Timer.h"
+
using namespace VISU;
#ifdef _DEBUG_
VisuGUI::
OnImportFromFile()
{
+ VisuGUI_Timer aTimer;
+ aTimer.Start();
+
if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
CheckLock(GetCStudy(GetAppStudy(this)));
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
tr("MEN_IMPORT_FROM_FILE"),
true);
if(aFileInfo.exists()) {
- application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
+ application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
VISU::Result_var aResult;
bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
tr("ERR_ERROR_IN_THE_FILE"),
tr("BUT_OK"));
}else{
- application()->putInfo(aFileInfo.filePath() + tr("INF_DONE"));
UpdateObjBrowser(this);
+ application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") +
+ " in " + aTimer.GetTime() + " seconds", -1 );
}
}
}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Timer.cxx
+// Module : SALOME
+
+#include "VisuGUI_Timer.h"
+
+#include "SUIT_Desktop.h"
+
+#include "utilities.h"
+
+#ifndef WNT
+static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
+#else
+//timezone *tz=_timezone;
+#endif
+
+#ifndef CLK_TCK
+# define CLK_TCK CLOCKS_PER_SEC
+#endif
+
+VisuGUI_Timer::VisuGUI_Timer() :
+ Utils_Timer()
+{
+}
+
+VisuGUI_Timer::~VisuGUI_Timer()
+{
+}
+
+void VisuGUI_Timer::Start()
+{
+ if (Stopped) {
+ Stopped = 0;
+#ifndef WNT
+ times(RefToInitialTMS);
+ gettimeofday(RefToInitialTimeB,tz);
+#else
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, RefToInitialTMS);
+ time(RefToCurrentTimeB);
+#endif
+ }
+}
+
+void VisuGUI_Timer::Stop()
+{
+ if (!Stopped) {
+#ifndef WNT
+ times(RefToCurrentTMS);
+ int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime;
+ 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 ;
+#else
+ SYSTEMTIME st;
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, RefToCurrentTMS);
+ Cumul_user += (int)(((ULARGE_INTEGER*)(RefToCurrentTMS))->QuadPart - ((ULARGE_INTEGER*)(RefToInitialTMS))->QuadPart) / 10000000;
+ Cumul_sys = Cumul_user;
+ time(RefToCurrentTimeB);
+#endif
+ Stopped = 1;
+ }
+}
+
+void VisuGUI_Timer::Reset() {
+ Stopped = 1;
+ Cumul_user = Cumul_sys = 0. ;
+}
+
+QString VisuGUI_Timer::GetTime() {
+ bool StopSav = Stopped;
+ if (!StopSav) Stop();
+
+ return QString::number( Cumul_user );
+
+ if (!StopSav) Start();
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : VisuGUI_Timer.h
+// Module : SALOME
+
+#include <Utils_Timer.hxx>
+
+#include <qstring.h>
+
+class VisuGUI_Timer : public Utils_Timer
+{
+ public:
+ VisuGUI_Timer();
+ virtual ~VisuGUI_Timer();
+
+ public:
+ void Start();
+ void Stop();
+ void Reset();
+
+ QString GetTime();
+};