CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <time.h>
29 #else
30 #include <sys/time.h>
31 #endif
32 
33 // user include files
34 
35 // forward declarations
36 namespace edm {
38  {
39 
40  public:
43  WallclockTimer(WallclockTimer&&) = default;
44 
45  // ---------- const member functions ---------------------
46  double realTime() const ;
47 
48  // ---------- static member functions --------------------
49 
50  // ---------- member functions ---------------------------
51  void start();
52  double stop(); //returns delta time
53  void reset();
54 
55  void add(double t);
56  private:
57  WallclockTimer(const WallclockTimer&) = delete; // stop default
58 
59  const WallclockTimer& operator=(const WallclockTimer&) = delete; // stop default
60 
61  double calculateDeltaTime() const;
62 
63  // ---------- member data --------------------------------
65 #ifdef USE_CLOCK_GETTIME
66  struct timespec startRealTime_;
67 #else
68  struct timeval startRealTime_;
69 #endif
70 
72 
73  };
74 }
75 
76 #endif
double calculateDeltaTime() const
double realTime() const
void add(double t)
enum edm::WallclockTimer::State state_
struct timeval startRealTime_
const WallclockTimer & operator=(const WallclockTimer &)=delete