CbmRoot
|
A timer class for the monitor. More...
#include <CaTimer.h>
Public Types | |
using | Clock = std::chrono::high_resolution_clock |
using | Duration = std::chrono::nanoseconds |
using | DurationCount = Duration::rep |
using | TimePoint = std::chrono::time_point<Clock, Duration> |
Public Member Functions | |
Timer ()=default | |
Default constructor. | |
~Timer ()=default | |
Destructor. | |
Timer (const Timer &)=default | |
Copy constructor. | |
Timer (Timer &&)=default | |
Move constructor. | |
Timer & | operator= (const Timer &)=default |
Copy assignment operator. | |
Timer & | operator= (Timer &&)=default |
Move assignment operator. | |
void | AddTimer (const Timer &other, bool parallel) |
Adds another timer. | |
double | GetAverage () const |
Gets average time [s]. | |
double | GetMax () const |
Gets time of the longest call [s]. | |
double | GetMin () const |
Gets time of the shortest call [s]. | |
int | GetNofCalls () const |
Gets number of calls. | |
int | GetMaxCallIndex () const |
Gets index of the longest call. | |
int | GetMinCallIndex () const |
Gets index of the longest call. | |
double | GetTotal () const |
Gets total time [s]. | |
double | GetTotalMs () const |
Gets total time [ms]. | |
void | Reset () |
Resets the timer. | |
void | Start () |
Starts the timer. | |
void | Stop () |
Stops the timer. | |
Private Member Functions | |
template<typename Archive > | |
void | serialize (Archive &ar, const unsigned int) |
Private Attributes | |
TimePoint | fStart = TimePoint() |
DurationCount | fMin = std::numeric_limits<DurationCount>::max() |
Minimal time period. | |
DurationCount | fMax = std::numeric_limits<DurationCount>::min() |
Maximal time period. | |
DurationCount | fTotal = DurationCount(0) |
Total measured time period [ns]. | |
int | fNofCalls = 0 |
Number of timer calls [ns]. | |
int | fMinCallIndex = -1 |
Index of the shortest call [ns]. | |
int | fMaxCallIndex = -1 |
Index of the longest call [ns]. | |
Friends | |
class | boost::serialization::access |
using cbm::algo::ca::Timer::Clock = std::chrono::high_resolution_clock |
using cbm::algo::ca::Timer::Duration = std::chrono::nanoseconds |
using cbm::algo::ca::Timer::DurationCount = Duration::rep |
using cbm::algo::ca::Timer::TimePoint = std::chrono::time_point<Clock, Duration> |
|
default |
Default constructor.
|
default |
Destructor.
|
default |
Copy constructor.
|
default |
Move constructor.
|
inline |
Adds another timer.
other | Reference to the other Timer object to add |
parallel | Bool: if the timers were executed in parallel |
If the parallel flag is true then the resulting fTotal time is taken as a maximum of each total time of the appended timers. If the parallel flag is false, the resulting fTotal is a sum of all timers.
Definition at line 120 of file CaTimer.h.
References fMax, fMaxCallIndex, fMin, fMinCallIndex, fNofCalls, and fTotal.
|
inline |
Gets average time [s].
Definition at line 59 of file CaTimer.h.
References fNofCalls, and fTotal.
Referenced by cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::ToString().
|
inline |
Gets time of the longest call [s].
Definition at line 62 of file CaTimer.h.
References fMax.
Referenced by cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::ToString().
|
inline |
|
inline |
Gets time of the shortest call [s].
Definition at line 65 of file CaTimer.h.
References fMin.
Referenced by cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::ToString().
|
inline |
|
inline |
Gets number of calls.
Definition at line 68 of file CaTimer.h.
References fNofCalls.
Referenced by cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::ToString().
|
inline |
Gets total time [s].
Definition at line 77 of file CaTimer.h.
References fTotal.
Referenced by GetTotalMs(), cbm::algo::TrackingChain::PrepareOutput(), and cbm::algo::ca::Monitor< ECounterKey, ETimerKey >::ToString().
|
inline |
Gets total time [ms].
Definition at line 80 of file CaTimer.h.
References GetTotal().
Referenced by cbm::algo::Reco::QueueTrackingMetrics().
|
inline |
Resets the timer.
Definition at line 143 of file CaTimer.h.
References fMax, fMaxCallIndex, fMin, fMinCallIndex, fNofCalls, fStart, and fTotal.
|
inlineprivate |
Definition at line 94 of file CaTimer.h.
References fMax, fMaxCallIndex, fMin, fMinCallIndex, fNofCalls, and fTotal.
|
inline |
Starts the timer.
Definition at line 86 of file CaTimer.h.
References fStart.
Referenced by cbm::algo::ca::TrackFinder::FindTracksThread().
|
inline |
Stops the timer.
Definition at line 156 of file CaTimer.h.
References fMax, fMaxCallIndex, fMin, fMinCallIndex, fNofCalls, fStart, and fTotal.
|
private |
Maximal time period.
Definition at line 106 of file CaTimer.h.
Referenced by AddTimer(), GetMax(), Reset(), serialize(), and Stop().
|
private |
Index of the longest call [ns].
Definition at line 110 of file CaTimer.h.
Referenced by AddTimer(), GetMaxCallIndex(), Reset(), serialize(), and Stop().
|
private |
Minimal time period.
Definition at line 105 of file CaTimer.h.
Referenced by AddTimer(), GetMin(), Reset(), serialize(), and Stop().
|
private |
Index of the shortest call [ns].
Definition at line 109 of file CaTimer.h.
Referenced by AddTimer(), GetMinCallIndex(), Reset(), serialize(), and Stop().
|
private |
Number of timer calls [ns].
Definition at line 108 of file CaTimer.h.
Referenced by AddTimer(), GetAverage(), GetNofCalls(), Reset(), serialize(), and Stop().
|
private |
Total measured time period [ns].
Definition at line 107 of file CaTimer.h.
Referenced by AddTimer(), GetAverage(), GetTotal(), Reset(), serialize(), and Stop().