CMS 3D CMS Logo

WallclockTimer.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_WallclockTimer_h
2 #define FWCore_Utilities_WallclockTimer_h
3 // -*- C++ -*-
4 //
5 // Package: Utilities
6 // Class : WallclockTimer
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sun Apr 16 20:32:13 EDT 2006
19 //
20 
21 // system include files
22 #ifdef __linux__
23 //clock_gettime is not available on OS X
24 #define USE_CLOCK_GETTIME
25 #endif
26 
27 #ifdef USE_CLOCK_GETTIME
28 #include <ctime>
29 #else
30 #include <sys/time.h>
31 #endif
32 
33 // user include files
34 
35 // forward declarations
36 namespace edm {
38  public:
41  WallclockTimer(WallclockTimer&&) = default;
42 
43  // ---------- const member functions ---------------------
44  double realTime() const;
45 
46  // ---------- static member functions --------------------
47 
48  // ---------- member functions ---------------------------
49  void start();
50  double stop(); //returns delta time
51  void reset();
52 
53  void add(double t);
54 
55  private:
56  WallclockTimer(const WallclockTimer&) = delete; // stop default
57 
58  const WallclockTimer& operator=(const WallclockTimer&) = delete; // stop default
59 
60  double calculateDeltaTime() const;
61 
62  // ---------- member data --------------------------------
64 #ifdef USE_CLOCK_GETTIME
65  struct timespec startRealTime_;
66 #else
67  struct timeval startRealTime_;
68 #endif
69 
71  };
72 } // namespace edm
73 
74 #endif
double calculateDeltaTime() const
double realTime() const
void add(double t)
enum edm::WallclockTimer::State state_
const WallclockTimer & operator=(const WallclockTimer &)=delete
HLT enums.