Warnings on vc14 were eliminated
[occt.git] / src / MoniTool / MoniTool_Timer.lxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14//=======================================================================
15//function : MoniTool_Timer
16//purpose :
17//=======================================================================
18
19inline MoniTool_Timer::MoniTool_Timer() : myCount(0), myNesting(0), myAmend(0)
20{
21}
22
23//=======================================================================
24//function : Timer
25//purpose :
26//=======================================================================
27
28inline OSD_Timer& MoniTool_Timer::Timer()
29{
30 return myTimer;
31}
32
33//=======================================================================
34//function : Timer
35//purpose :
36//=======================================================================
37
38inline const OSD_Timer& MoniTool_Timer::Timer() const
39{
40 return myTimer;
41}
42
43//=======================================================================
44//function : Start
45//purpose :
46//=======================================================================
47
48inline void MoniTool_Timer::Start()
49{
50// AmendStart();
51 if ( ! myNesting ) myTimer.Start();
52 myCount++;
53 myNesting++;
54}
55
56//=======================================================================
57//function : Stop
58//purpose :
59//=======================================================================
60
61inline void MoniTool_Timer::Stop()
62{
63 myNesting--;
64 if ( ! myNesting ) myTimer.Stop();
65// AmendStop();
66}
67
68//=======================================================================
69//function : Reset
70//purpose :
71//=======================================================================
72
73inline void MoniTool_Timer::Reset()
74{
75 myTimer.Reset();
76 myCount = myNesting = 0;
77 myAmend = 0;
78}
79
80//=======================================================================
81//function : Count
82//purpose :
83//=======================================================================
84
85inline Standard_Integer MoniTool_Timer::Count() const
86{
87 return myCount;
88}
89
90//=======================================================================
91//function : IsRunning
92//purpose :
93//=======================================================================
94
95inline Standard_Integer MoniTool_Timer::IsRunning() const
96{
97 return myNesting;
98}
99
100//=======================================================================
101//function : Amend
102//purpose :
103//=======================================================================
104
105inline Standard_Real MoniTool_Timer::Amend() const
106{
107 return myAmend;
108}
109
110//=======================================================================
111//function : CPU
112//purpose :
113//=======================================================================
114
115inline Standard_Real MoniTool_Timer::CPU()
116{
117 Standard_Integer minutes, hours;
118 Standard_Real seconds, cpu;
119 myTimer.Show(seconds,minutes,hours,cpu);
120 return cpu - myAmend;
121}
122
123//=======================================================================
124//function : Start
125//purpose :
126//=======================================================================
127
128inline void MoniTool_Timer::Start(const Standard_CString name)
129{
130 Timer(name)->Start();
131}
132
133//=======================================================================
134//function : Stop
135//purpose :
136//=======================================================================
137
138inline void MoniTool_Timer::Stop(const Standard_CString name)
139{
140 Timer(name)->Stop();
141}