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  WallclockTimer(const WallclockTimer&) = delete;
43  WallclockTimer& operator=(const WallclockTimer&) = delete;
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 
57  private:
58  double calculateDeltaTime() const;
59 
60  // ---------- member data --------------------------------
62 #ifdef USE_CLOCK_GETTIME
63  struct timespec startRealTime_;
64 #else
65  struct timeval startRealTime_;
66 #endif
67 
69  };
70 } // namespace edm
71 
72 #endif
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::WallclockTimer::kStopped
Definition: WallclockTimer.h:61
edm::WallclockTimer::realTime
double realTime() const
Definition: WallclockTimer.cc:110
edm::WallclockTimer::operator=
WallclockTimer & operator=(const WallclockTimer &)=delete
edm::WallclockTimer::add
void add(double t)
Definition: WallclockTimer.cc:87
edm::WallclockTimer
Definition: WallclockTimer.h:37
edm::WallclockTimer::start
void start()
Definition: WallclockTimer.cc:63
edm::WallclockTimer::kRunning
Definition: WallclockTimer.h:61
edm::WallclockTimer::State
State
Definition: WallclockTimer.h:61
edm::WallclockTimer::accumulatedRealTime_
double accumulatedRealTime_
Definition: WallclockTimer.h:68
edm::WallclockTimer::WallclockTimer
WallclockTimer()
Definition: WallclockTimer.cc:33
edm::WallclockTimer::startRealTime_
struct timeval startRealTime_
Definition: WallclockTimer.h:65
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
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::WallclockTimer::~WallclockTimer
~WallclockTimer()
Definition: WallclockTimer.cc:47
edm::WallclockTimer::calculateDeltaTime
double calculateDeltaTime() const
Definition: WallclockTimer.cc:89