Warning, /include/opencascade/MoniTool_Timer.lxx is written in an unsupported language. File is not indexed.
0001 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013
0014 //=================================================================================================
0015
0016 inline MoniTool_Timer::MoniTool_Timer()
0017 : myCount(0),
0018 myNesting(0),
0019 myAmend(0)
0020 {
0021 }
0022
0023 //=================================================================================================
0024
0025 inline OSD_Timer& MoniTool_Timer::Timer()
0026 {
0027 return myTimer;
0028 }
0029
0030 //=================================================================================================
0031
0032 inline const OSD_Timer& MoniTool_Timer::Timer() const
0033 {
0034 return myTimer;
0035 }
0036
0037 //=================================================================================================
0038
0039 inline void MoniTool_Timer::Start()
0040 {
0041 // AmendStart();
0042 if (!myNesting)
0043 myTimer.Start();
0044 myCount++;
0045 myNesting++;
0046 }
0047
0048 //=================================================================================================
0049
0050 inline void MoniTool_Timer::Stop()
0051 {
0052 myNesting--;
0053 if (!myNesting)
0054 myTimer.Stop();
0055 // AmendStop();
0056 }
0057
0058 //=================================================================================================
0059
0060 inline void MoniTool_Timer::Reset()
0061 {
0062 myTimer.Reset();
0063 myCount = myNesting = 0;
0064 myAmend = 0;
0065 }
0066
0067 //=================================================================================================
0068
0069 inline int MoniTool_Timer::Count() const
0070 {
0071 return myCount;
0072 }
0073
0074 //=================================================================================================
0075
0076 inline int MoniTool_Timer::IsRunning() const
0077 {
0078 return myNesting;
0079 }
0080
0081 //=================================================================================================
0082
0083 inline double MoniTool_Timer::Amend() const
0084 {
0085 return myAmend;
0086 }
0087
0088 //=================================================================================================
0089
0090 inline double MoniTool_Timer::CPU()
0091 {
0092 int minutes, hours;
0093 double seconds, cpu;
0094 myTimer.Show(seconds, minutes, hours, cpu);
0095 return cpu - myAmend;
0096 }
0097
0098 //=================================================================================================
0099
0100 inline void MoniTool_Timer::Start(const char* const name)
0101 {
0102 Timer(name)->Start();
0103 }
0104
0105 //=================================================================================================
0106
0107 inline void MoniTool_Timer::Stop(const char* const name)
0108 {
0109 Timer(name)->Stop();
0110 }