MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlTimer.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2010, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13// A timer implementation that is thread-aware.
14
15#ifndef ML_TIMER_H
16#define ML_TIMER_H
17
19
20
21class MLTimeProfile;
22
24{
25public:
28
31
34
35 void start();
36 void stop();
37
39 void start(MLTimer& otherToPause);
40
43
47 double elapsed() const
48 {
49 return _elapsed;
50 }
51
54 double consumed() const
55 {
56 return _elapsed - _pausedElapsed;
57 }
58 unsigned int startCount() const
59 {
60 return _startCount;
61 }
62
63private:
64 double _startTime{0};
65 double _pausedStartTime{0};
66 double _pausedElapsed{0};
67 double _elapsed{0};
68 bool _isActive{false};
69 bool _isPaused{false};
70 unsigned int _startCount{0};
71
72 friend class MLTimeProfile;
73 friend class MLCallGraphNode;
74};
75
76
77#endif
MLTimer() noexcept=default
double consumed() const
Returns the elapsed time minus the time between pause() and resume() calls in seconds.
Definition mlTimer.h:54
unsigned int startCount() const
Definition mlTimer.h:58
#define MLPROFILINGMANAGER_EXPORT
Target mlrange_cast(Source arg)
Generic version of checked ML casts.