12#include <boost/serialization/serialization.hpp>
27 using Clock = std::chrono::high_resolution_clock;
30 using TimePoint = std::chrono::time_point<Clock, Duration>;
62 double GetMax()
const {
return static_cast<double>(
fMax) * 1.e-9; }
65 double GetMin()
const {
return static_cast<double>(
fMin) * 1.e-9; }
93 template<
typename Archive>
146 fMin = std::numeric_limits<DurationCount>::max();
147 fMax = std::numeric_limits<DurationCount>::min();
158 auto stop = Clock::now();
159 auto time = std::chrono::duration_cast<Duration>(stop -
fStart).count();
A timer class for the monitor.
void serialize(Archive &ar, const unsigned int)
Timer & operator=(Timer &&)=default
Move assignment operator.
Timer(const Timer &)=default
Copy constructor.
Timer(Timer &&)=default
Move constructor.
DurationCount fTotal
Total measured time period [ns].
std::chrono::high_resolution_clock Clock
void Stop()
Stops the timer.
int fMinCallIndex
Index of the shortest call [ns].
int GetMaxCallIndex() const
Gets index of the longest call.
double GetTotalMs() const
Gets total time [ms].
void AddTimer(const Timer &other, bool parallel)
Adds another timer.
Timer()=default
Default constructor.
void Start()
Starts the timer.
Timer & operator=(const Timer &)=default
Copy assignment operator.
double GetTotal() const
Gets total time [s].
DurationCount fMax
Maximal time period.
int fNofCalls
Number of timer calls [ns].
double GetMin() const
Gets time of the shortest call [s].
std::chrono::nanoseconds Duration
int fMaxCallIndex
Index of the longest call [ns].
int GetMinCallIndex() const
Gets index of the longest call.
void Reset()
Resets the timer.
double GetAverage() const
Gets average time [s].
int GetNofCalls() const
Gets number of calls.
friend class boost::serialization::access
std::chrono::time_point< Clock, Duration > TimePoint
double GetMax() const
Gets time of the longest call [s].
Duration::rep DurationCount
DurationCount fMin
Minimal time period.
~Timer()=default
Destructor.
TODO: SZh 8.11.2022: add selection of parameterisation.