casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
C11Timer.h
Go to the documentation of this file.
1 #ifndef COMPONENTS_C11TIMER_H
2 #define COMPONENTS_C11TIMER_H
3 
4 #include <chrono>
5 
6 #include <casa/namespace.h>
7 
8 namespace casa {
9 
10 class C11Timer {
11  // <summary>
12  // casacore::Timer based on C++11 chrono library
13  // </summary>
14 
15  // <reviewed reviewer="" date="" tests="" demos="">
16  // </reviewed>
17 
18  // <prerequisite>
19  // </prerequisite>
20 
21  // <etymology>
22  // casacore::Timer based on C++11 chrono library
23  // </etymology>
24 
25  // <synopsis>
26  // casacore::Timer based on C++11 chrono library
27  // </synopsis>
28 
29 public:
30  // create the timer but do not start it.
31  C11Timer();
32 
33  ~C11Timer();
34 
35  // return mean duration, in seconds, of all start/stop cycles
37 
38  // duration in seconds of most recent start/stop cycle
39  casacore::Double duration() const;
40 
41  // number of start/stop cycles
42  casacore::uInt nCycles() const;
43 
44  // (re)start the timer
45  void start();
46 
47  // stop the timer
48  void stop();
49 
50  // total duration in seconds, sum of all start/stop cycles
51  // doesn't include the duration of the current cycle if the
52  // timer is currently running
54 
55 private:
56  std::chrono::steady_clock::time_point _start;
57  std::chrono::duration<double> _duration, _totalDuration;
59 
60 
61 };
62 }
63 
64 #endif
void stop()
stop the timer
void start()
(re)start the timer
casacore::Double totalDuration() const
total duration in seconds, sum of all start/stop cycles doesn&#39;t include the duration of the current c...
C11Timer()
casacore::Timer based on C++11 chrono library
casacore::Double meanDuration() const
return mean duration, in seconds, of all start/stop cycles
casacore::Double duration() const
duration in seconds of most recent start/stop cycle
double Double
Definition: aipstype.h:55
casacore::uInt _nCycles
Definition: C11Timer.h:58
std::chrono::duration< double > _totalDuration
Definition: C11Timer.h:57
std::chrono::steady_clock::time_point _start
Definition: C11Timer.h:56
casacore::uInt nCycles() const
number of start/stop cycles
std::chrono::duration< double > _duration
Definition: C11Timer.h:57
unsigned int uInt
Definition: aipstype.h:51