test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastTimer.h
Go to the documentation of this file.
1 #ifndef FastTimer_h
2 #define FastTimer_h
3 
4 // C++ headers
5 #include <chrono>
6 
7 class FastTimer {
8 public:
9  typedef std::chrono::high_resolution_clock Clock;
11  enum class State {
12  kStopped,
13  kRunning,
14  kPaused
15  };
16 
17  FastTimer();
18 
19  void start();
20  void pause();
21  void resume();
22  void stop();
23  void reset();
24 
25  Duration value() const;
26  Duration untilNow() const;
27  double seconds() const;
28  double secondsUntilNow() const;
29  State state() const;
30  Clock::time_point const & getStartTime() const;
31  Clock::time_point const & getStopTime() const;
32  void setStartTime(Clock::time_point const &);
33  void setStopTime(Clock::time_point const &);
34 
35 private:
36  std::string const & describe() const;
37 
38  Clock::time_point m_start;
39  Clock::time_point m_stop;
42 };
43 
44 #endif // ! FastTimer_h
Clock::time_point const & getStartTime() const
Definition: FastTimer.cc:109
FastTimer()
Definition: FastTimer.cc:9
void resume()
Definition: FastTimer.cc:51
void setStartTime(Clock::time_point const &)
Definition: FastTimer.cc:117
double secondsUntilNow() const
Definition: FastTimer.cc:85
Duration m_duration
Definition: FastTimer.h:40
Duration untilNow() const
Definition: FastTimer.cc:81
void stop()
Definition: FastTimer.cc:29
void pause()
Definition: FastTimer.cc:40
void setStopTime(Clock::time_point const &)
Definition: FastTimer.cc:128
Clock::time_point m_stop
Definition: FastTimer.h:39
double seconds() const
Definition: FastTimer.cc:75
State state() const
Definition: FastTimer.cc:90
Duration value() const
Definition: FastTimer.cc:70
Clock::time_point const & getStopTime() const
Definition: FastTimer.cc:113
void reset()
Definition: FastTimer.cc:62
Clock::time_point m_start
Definition: FastTimer.h:38
State
Definition: hltDiff.cc:287
State m_state
Definition: FastTimer.h:41
std::string const & describe() const
Definition: FastTimer.cc:95
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
std::chrono::high_resolution_clock Clock
Definition: FastTimer.h:9
std::chrono::nanoseconds Duration
Definition: FastTimer.h:10
void start()
Definition: FastTimer.cc:17