Management of a timer. More...
#include <arcane/core/Timer.h>
Classes | |
| class | Sentry |
| Sentinel for the timer. The sentinel associated with a timer allows it to be triggered upon its construction and stopped upon its destruction. This ensures that the timer will be properly stopped in case of an exception, for example. More... | |
| class | Action |
| Positions the name of the currently executing action. More... | |
| class | Phase |
| Positions the phase of the currently executing action. More... | |
| class | SimplePrinter |
| Displays the time elapsed between the call to the constructor and the destructor. More... | |
Public Types | |
| enum | eTimerType { TimerVirtual , TimerReal } |
| Timer type. More... | |
Public Member Functions | |
| Timer (ISubDomain *sd, const String &name, eTimerType type) | |
| Constructs a timer. | |
| Timer (ITimerMng *tm, const String &name, eTimerType type) | |
| Constructs a timer. | |
| ~Timer () | |
| Frees resources. | |
| void | start () |
| Activates the timer. | |
| Real | stop () |
| Deactivates the timer. | |
| bool | isActivated () const |
| Returns the activation status of the timer. | |
| const String & | name () const |
| Returns the name of the timer. | |
| Real | totalTime () const |
| Returns the total time (in seconds) spent in the timer. | |
| Real | lastActivationTime () const |
| Returns the time (in seconds) spent during the last activation of the timer. | |
| Integer | nbActivated () const |
| Returns the number of times the timer has been activated. | |
| eTimerType | type () const |
| Returns the type of time used. | |
| void | reset () |
| Resets the time counters. | |
| ITimerMng * | timerMng () const |
| Manager associated with this timer. | |
| void | _setStartTime (Real t) |
| Real | _startTime () const |
Static Public Member Functions | |
| static TimeMetricAction | phaseAction (ITimeStats *s, eTimePhase phase) |
Management of a timer.
An instance of this class allows measuring the time elapsed between its activation via the start() method and its stopping via the stop() method.
The timer can be used multiple times, and it is possible to know both the number of activations (nbActivated()) and the total time spent in its successive activations (totalTime()).
There are two operating modes:
The timer resolution depends on the machine. It is on the order of milliseconds for timers using CPU time and on the order of microseconds for timers using real time.
| Arcane::Timer::Timer | ( | ISubDomain * | sd, |
| const String & | name, | ||
| eTimerType | type ) |
Constructs a timer.
Constructs a timer linked to the sub-domain sd, with name name and type type.
Definition at line 36 of file Timer.cc.
References name(), Timer(), timerMng(), and type().
Referenced by Arcane::Timer::Sentry::Sentry(), and Timer().
| Arcane::Timer::Timer | ( | ITimerMng * | tm, |
| const String & | name, | ||
| eTimerType | type ) |
|
inline |
|
inline |
Returns the time (in seconds) spent during the last activation of the timer.
Definition at line 243 of file Timer.h.
Referenced by Arcane::Materials::ItemMaterialVariableScalar< DataType >::synchronize().
|
inline |
|
inline |
|
static |
| void Arcane::Timer::start | ( | ) |
Activates the timer.
If the timer is already active, this method does nothing.
Definition at line 69 of file Timer.cc.
References ARCANE_FATAL.
| Real Arcane::Timer::stop | ( | ) |
Deactivates the timer.
If the timer is not active at the time of the call, this method does not do anything.
Definition at line 86 of file Timer.cc.
References ARCANE_FATAL.
|
inline |
|
inline |
|
inline |