CMS 3D CMS Logo

Timer.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_Timer_h
2 #define L1Trigger_TrackFindingTracklet_interface_Timer_h
3 
4 #include <cmath>
5 #include <chrono>
6 
7 namespace trklet {
8 
9  class Timer {
10  public:
11  Timer() {}
12 
13  ~Timer() = default;
14 
15  void start();
16  void stop();
17  unsigned int ntimes() const { return ntimes_; }
18  double avgtime() const { return ttot_ / ntimes_; }
19  double rms() const { return sqrt((ttot_ * ttot_ - ttotsq_)) / ntimes_; }
20  double tottime() const { return ttot_; }
21 
22  private:
23  unsigned int ntimes_{0};
24  double ttot_{0.0};
25  double ttotsq_{0.0};
26 
27  std::chrono::high_resolution_clock::time_point tstart_;
28  };
29 }; // namespace trklet
30 #endif
trklet::Timer::tstart_
std::chrono::high_resolution_clock::time_point tstart_
Definition: Timer.h:27
trklet::Timer::rms
double rms() const
Definition: Timer.h:19
trklet::Timer::avgtime
double avgtime() const
Definition: Timer.h:18
trklet::Timer::ttotsq_
double ttotsq_
Definition: Timer.h:25
trklet::Timer
Definition: Timer.h:9
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
trklet::Timer::ntimes
unsigned int ntimes() const
Definition: Timer.h:17
trklet::Timer::start
void start()
Definition: Timer.cc:5
trklet::Timer::ttot_
double ttot_
Definition: Timer.h:24
trklet::Timer::stop
void stop()
Definition: Timer.cc:6
trklet
Definition: AllProjectionsMemory.h:9
trklet::Timer::tottime
double tottime() const
Definition: Timer.h:20
trklet::Timer::ntimes_
unsigned int ntimes_
Definition: Timer.h:23
trklet::Timer::Timer
Timer()
Definition: Timer.h:11
trklet::Timer::~Timer
~Timer()=default