![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Class used to compute response times for benchmark purposes. More...
#include <agrum/base/core/timer.h>
Public Member Functions | |
Constructors / Destructors | |
| Timer () | |
| Default constructor (launching the timer). | |
| Timer (const Timer &timer) | |
| Copy constructor. | |
| ~Timer () | |
| Destructor. | |
Operators | |
| Timer & | operator= (const Timer &timer) |
| Copy operator. | |
Timer manipulation | |
| void | reset () |
| Reset the timer. | |
| double | pause () |
| Pause the timer and return the delta (. | |
| double | resume () |
| Resume the timer and return the delta (. | |
| double | step () const |
| Returns the delta time between now and the last reset() call (or the constructor). | |
| std::string | toString () const |
| Returns the delta time between now and the last reset() in a human format. | |
Protected Member Functions | |
| std::chrono::duration< double, std::milli > | step_ () const |
Protected Attributes | |
| std::chrono::high_resolution_clock::time_point | start_ |
| Time of the last call to reset() or the constructor. | |
| std::chrono::high_resolution_clock::time_point | pause_ |
| Time of the last call to pause(). | |
| bool | sleeping_ |
| False if running. | |
Class used to compute response times for benchmark purposes.
This class represents a classic timer, it starts in the constructor, you can reset it with method reset() and you can get the delta time with the method step().
This class uses double for representing time data, all the values are in seconds, and the precision is about 0.001 s
| gum::Timer::Timer | ( | ) |
Default constructor (launching the timer).
Definition at line 61 of file timer.cpp.
References Timer(), and reset().
Referenced by Timer(), Timer(), ~Timer(), and operator=().
| gum::Timer::Timer | ( | const Timer & | timer | ) |
Copy constructor.
| timer | The gum::Timer to copy. |
Definition at line 66 of file timer.cpp.
References Timer(), pause_, sleeping_, and start_.
| gum::Timer::~Timer | ( | ) |
Copy operator.
| timer | The gum::Timer to copy. |
Definition at line 76 of file timer.cpp.
References Timer(), pause_, sleeping_, and start_.
| INLINE double gum::Timer::pause | ( | ) |
Pause the timer and return the delta (.
Returns the delta (
Definition at line 74 of file timer_inl.h.
References pause_, sleeping_, and step().
| INLINE void gum::Timer::reset | ( | ) |
Reset the timer.
Definition at line 52 of file timer_inl.h.
References pause_, sleeping_, and start_.
Referenced by Timer(), gum::learning::BNDatabaseGenerator< GUM_SCALAR >::drawSamples(), and gum::prm::o3prmr::O3prmrInterpreter::query().
| INLINE double gum::Timer::resume | ( | ) |
Resume the timer and return the delta (.
Returns the delta (
Definition at line 84 of file timer_inl.h.
References pause_, sleeping_, start_, and step().
| INLINE double gum::Timer::step | ( | ) | const |
Returns the delta time between now and the last reset() call (or the constructor).
Definition at line 71 of file timer_inl.h.
References step_().
Referenced by gum::learning::BNDatabaseGenerator< GUM_SCALAR >::drawSamples(), pause(), gum::prm::o3prmr::O3prmrInterpreter::query(), resume(), and toString().
|
protected |
| std::string gum::Timer::toString | ( | ) | const |
Returns the delta time between now and the last reset() in a human format.
Definition at line 84 of file timer.cpp.
References step().
Referenced by gum::operator<<().
|
protected |
|
protected |
|
protected |