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
edm::WallclockTimer::operator=
const WallclockTimer & operator=(const WallclockTimer &)=delete
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::WallclockTimer::kStopped
Definition: WallclockTimer.h:63
edm::WallclockTimer::realTime
double realTime() const
Definition: WallclockTimer.cc:110
edm::WallclockTimer::add
void add(double t)
Definition: WallclockTimer.cc:87
OrderedSet.t
t
Definition: OrderedSet.py:90
edm::WallclockTimer
Definition: WallclockTimer.h:37
edm::WallclockTimer::start
void start()
Definition: WallclockTimer.cc:63
edm::WallclockTimer::kRunning
Definition: WallclockTimer.h:63
edm::WallclockTimer::State
State
Definition: WallclockTimer.h:63
edm::WallclockTimer::accumulatedRealTime_
double accumulatedRealTime_
Definition: WallclockTimer.h:70
edm::WallclockTimer::WallclockTimer
WallclockTimer()
Definition: WallclockTimer.cc:33
edm::WallclockTimer::startRealTime_
struct timeval startRealTime_
Definition: WallclockTimer.h:67
edm::WallclockTimer::state_
enum edm::WallclockTimer::State state_
edm::WallclockTimer::reset
void reset()
Definition: WallclockTimer.cc:85
edm::WallclockTimer::stop
double stop()
Definition: WallclockTimer.cc:74
edm::WallclockTimer::~WallclockTimer
~WallclockTimer()
Definition: WallclockTimer.cc:47
edm::WallclockTimer::calculateDeltaTime
double calculateDeltaTime() const
Definition: WallclockTimer.cc:89