CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::Timer Class Reference

#include <Timer.h>

Public Member Functions

double avgtime () const
 
unsigned int ntimes () const
 
double rms () const
 
void start ()
 
void stop ()
 
 Timer ()
 
double tottime () const
 
 ~Timer ()=default
 

Private Attributes

unsigned int ntimes_ {0}
 
std::chrono::high_resolution_clock::time_point tstart_
 
double ttot_ {0.0}
 
double ttotsq_ {0.0}
 

Detailed Description

Definition at line 9 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer()

trklet::Timer::Timer ( )
inline

Definition at line 11 of file Timer.h.

11 {}

◆ ~Timer()

trklet::Timer::~Timer ( )
default

Member Function Documentation

◆ avgtime()

double trklet::Timer::avgtime ( ) const
inline

Definition at line 18 of file Timer.h.

References ntimes_, and ttot_.

Referenced by trklet::TrackletEventProcessor::printSummary().

18 { return ttot_ / ntimes_; }
double ttot_
Definition: Timer.h:24
unsigned int ntimes_
Definition: Timer.h:23

◆ ntimes()

unsigned int trklet::Timer::ntimes ( ) const
inline

Definition at line 17 of file Timer.h.

References ntimes_.

Referenced by trklet::TrackletEventProcessor::printSummary().

17 { return ntimes_; }
unsigned int ntimes_
Definition: Timer.h:23

◆ rms()

double trklet::Timer::rms ( ) const
inline

Definition at line 19 of file Timer.h.

References ntimes_, mathSSE::sqrt(), ttot_, and ttotsq_.

19 { return sqrt((ttot_ * ttot_ - ttotsq_)) / ntimes_; }
T sqrt(T t)
Definition: SSEVec.h:23
double ttotsq_
Definition: Timer.h:25
double ttot_
Definition: Timer.h:24
unsigned int ntimes_
Definition: Timer.h:23

◆ start()

void Timer::start ( )

Definition at line 5 of file Timer.cc.

References submitPVValidationJobs::now, and tstart_.

Referenced by progressbar.ProgressBar::__next__(), and trklet::TrackletEventProcessor::event().

std::chrono::high_resolution_clock::time_point tstart_
Definition: Timer.h:27

◆ stop()

void Timer::stop ( )

Definition at line 6 of file Timer.cc.

References submitPVResolutionJobs::count, submitPVValidationJobs::now, ntimes_, createJobs::tmp, tstart_, ttot_, and ttotsq_.

Referenced by trklet::TrackletEventProcessor::event().

6  {
8  double tmp = std::chrono::duration<double>(tstop - tstart_).count();
9  ttot_ += tmp;
10  ttotsq_ += tmp * tmp;
11  ntimes_++;
12 }
double ttotsq_
Definition: Timer.h:25
double ttot_
Definition: Timer.h:24
tmp
align.sh
Definition: createJobs.py:716
unsigned int ntimes_
Definition: Timer.h:23
std::chrono::high_resolution_clock::time_point tstart_
Definition: Timer.h:27

◆ tottime()

double trklet::Timer::tottime ( ) const
inline

Definition at line 20 of file Timer.h.

References ttot_.

Referenced by trklet::TrackletEventProcessor::printSummary().

20 { return ttot_; }
double ttot_
Definition: Timer.h:24

Member Data Documentation

◆ ntimes_

unsigned int trklet::Timer::ntimes_ {0}
private

Definition at line 23 of file Timer.h.

Referenced by avgtime(), ntimes(), rms(), and stop().

◆ tstart_

std::chrono::high_resolution_clock::time_point trklet::Timer::tstart_
private

Definition at line 27 of file Timer.h.

Referenced by start(), and stop().

◆ ttot_

double trklet::Timer::ttot_ {0.0}
private

Definition at line 24 of file Timer.h.

Referenced by avgtime(), rms(), stop(), and tottime().

◆ ttotsq_

double trklet::Timer::ttotsq_ {0.0}
private

Definition at line 25 of file Timer.h.

Referenced by rms(), and stop().