Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
|
Wall-clock timer. More...
#include <Teuchos_Time.hpp>
Public Member Functions | |
Time (const std::string &name, bool start=false) | |
Constructor. More... | |
void | start (bool reset=false) |
Start the timer, if the timer is enabled (see disable()). More... | |
double | stop () |
Stop the timer, if the timer is enabled (see disable()). More... | |
void | disable () |
"Disable" this timer, so that it ignores calls to start() and stop(). More... | |
void | enable () |
"Enable" this timer, so that it (again) respects calls to start() and stop(). More... | |
bool | isEnabled () const |
Whether the timer is enabled (see disable()). More... | |
double | totalElapsedTime (bool readCurrentTime=false) const |
The total time in seconds accumulated by this timer. More... | |
void | reset () |
Reset the cummulative time and call count. More... | |
bool | isRunning () const |
Whether the timer is currently running. More... | |
const std::string & | name () const |
The name of this timer. More... | |
void | incrementNumCalls () |
Increment the number of times this timer has been called, if the timer is enabled (see disable()). More... | |
int | numCalls () const |
The number of times this timer has been called while enabled. More... | |
Static Public Member Functions | |
static double | wallTime () |
Current wall-clock time in seconds. More... | |
Private Attributes | |
double | startTime_ |
double | totalTime_ |
bool | isRunning_ |
bool | enabled_ |
std::string | name_ |
int | numCalls_ |
Wall-clock timer.
To time a section of code, place it in between calls to start() and stop(). It is better to access this class through the TimeMonitor class (which see) for exception safety and correct behavior in reentrant code.
If Teuchos is configured with TPL_ENABLE_Valgrind=ON
and Teuchos_TIME_MASSIF_SNAPSHOTS=ON
Valgrind Massif snapshots are taken before and after Teuchos::Time invocation. The resulting memory profile can be plotted using core/utils/plotMassifMemoryUsage.py
Definition at line 53 of file Teuchos_Time.hpp.
Teuchos::Time::Time | ( | const std::string & | name, |
bool | start = false |
||
) |
Constructor.
name | [in] Name of the timer. |
start | [in] If true, start the timer upon creating it. By default, the timer only starts running when you call start(). |
Definition at line 76 of file Teuchos_Time.cpp.
|
static |
Current wall-clock time in seconds.
This is only useful for measuring time intervals. The absolute value returned is measured relative to some arbitrary time in the past.
Definition at line 163 of file Teuchos_Time.cpp.
void Teuchos::Time::start | ( | bool | reset = false | ) |
Start the timer, if the timer is enabled (see disable()).
reset | [in] If true, reset the timer's total elapsed time to zero before starting the timer. By default, the timer accumulates the total elapsed time for all start() ... stop() sequences. |
Definition at line 85 of file Teuchos_Time.cpp.
double Teuchos::Time::stop | ( | ) |
Stop the timer, if the timer is enabled (see disable()).
Definition at line 109 of file Teuchos_Time.cpp.
void Teuchos::Time::disable | ( | ) |
"Disable" this timer, so that it ignores calls to start() and stop().
Definition at line 149 of file Teuchos_Time.cpp.
void Teuchos::Time::enable | ( | ) |
"Enable" this timer, so that it (again) respects calls to start() and stop().
Definition at line 153 of file Teuchos_Time.cpp.
|
inline |
Whether the timer is enabled (see disable()).
Definition at line 87 of file Teuchos_Time.hpp.
double Teuchos::Time::totalElapsedTime | ( | bool | readCurrentTime = false | ) | const |
The total time in seconds accumulated by this timer.
readCurrentTime | [in] If true, return the current elapsed time since the first call to start() when the timer was enabled, whether or not the timer is running or enabled. If false, return the total elapsed time as of the last call to stop() when the timer was enabled. |
Definition at line 137 of file Teuchos_Time.cpp.
void Teuchos::Time::reset | ( | ) |
Reset the cummulative time and call count.
Definition at line 144 of file Teuchos_Time.cpp.
|
inline |
Whether the timer is currently running.
"Currently running" means either that start() has been called without an intervening stop() call, or that the timer was created already running and stop() has not since been called.
Definition at line 112 of file Teuchos_Time.hpp.
|
inline |
The name of this timer.
Definition at line 117 of file Teuchos_Time.hpp.
void Teuchos::Time::incrementNumCalls | ( | ) |
Increment the number of times this timer has been called, if the timer is enabled (see disable()).
Definition at line 157 of file Teuchos_Time.cpp.
|
inline |
The number of times this timer has been called while enabled.
Definition at line 126 of file Teuchos_Time.hpp.
|
private |
Definition at line 129 of file Teuchos_Time.hpp.
|
private |
Definition at line 130 of file Teuchos_Time.hpp.
|
private |
Definition at line 131 of file Teuchos_Time.hpp.
|
private |
Definition at line 132 of file Teuchos_Time.hpp.
|
private |
Definition at line 133 of file Teuchos_Time.hpp.
|
private |
Definition at line 134 of file Teuchos_Time.hpp.