Teuchos - Trilinos Tools Package
Version of the Day
|
Timer info at a given level and all the children. More...
#include <Teuchos_StackedTimer.hpp>
Public Member Functions | |
LevelTimer () | |
Default constructor, shouldn't be used but needed for std::vector. More... | |
LevelTimer (int level, const char *name="RootTimer", LevelTimer *parent=nullptr, bool start_timer=true) | |
LevelTimer (const LevelTimer &src) | |
Copy constructor. More... | |
LevelTimer * | start (const char *sub_name) |
LevelTimer * | stop (const std::string &name="RootTimer") |
std::string | get_full_name () const |
int | countTimers () |
double | accumulatedTime (const std::string &locate_name="") |
unsigned | level () const |
Returns the level of the timer in the stack. More... | |
double | accumulatedTimePerUpdate (const std::string &locate_name="") |
double | accumulatedTimePerTimerCall (const std::string &locate_name="") |
void | pack () |
LevelTimer * | unpack (unsigned from) |
void | report (std::ostream &os) |
const BaseTimer * | findBaseTimer (const std::string &name) const |
BaseTimer::TimeInfo | findTimer (const std::string &name, bool &found) |
Public Member Functions inherited from Teuchos::BaseTimer | |
void | start () |
Start a currently stopped timer. More... | |
void | stop () |
Stop a current running timer and accumulate time difference. More... | |
unsigned long long | incrementUpdates (unsigned long long count=1) |
Increment the total number of items updated between a start stop. More... | |
double | accumulatedTime () const |
Get the total accumulated time since last reset or construction when the timer is running. More... | |
void | setAccumulatedTime (double accum=0) |
Setter for accumulated time. More... | |
double | accumulatedTimePerUpdate () const |
return the average time per item updated More... | |
double | accumulatedTimePerTimerCall () const |
return the average time per timer start/stop More... | |
double | difference (const BaseTimer &from) const |
Return the difference between two timers in seconds,. More... | |
void | reset () |
Reset all the timer stats, throws if it is already running. More... | |
bool | running () const |
Returns true if the timer is currently accumulating time. More... | |
unsigned long | numCalls () const |
Returns the number of calls to start(). More... | |
unsigned long long | numUpdates () const |
Returns the number of updates added to this timer. More... | |
void | overrideNumCallsForUnitTesting (const unsigned long num_calls) |
Sets the number of calls to start() for this timer. This is only used for unit testing. More... | |
void | overrideNumUpdatesForUnitTesting (const unsigned long long num_updates) |
Sets the number of counts for this timer. This is only used for unit testing. More... | |
Protected Member Functions | |
void | splitString (const std::string &locate_name, std::string &first_name, std::string &second_name) |
split a string into two parts split by a '@' if no '@' first gets the full string More... | |
Timer info at a given level and all the children.
This holds the timer info for the leaf node of a timer stack. It has both its timer info and all the sub leaves bellow it. You can start and stop sub timers, get sub info and dump out things to a ostream
Definition at line 203 of file Teuchos_StackedTimer.hpp.
Teuchos::StackedTimer::LevelTimer::LevelTimer | ( | ) |
Default constructor, shouldn't be used but needed for std::vector.
Definition at line 22 of file Teuchos_StackedTimer.cpp.
|
inline |
Standard constructor
[in] | level | Integer level of this timer |
[in] | name | Name for this timer |
[in] | parent | Parent of this timer |
[in] | start | bool to start the timer on construction |
Definition at line 223 of file Teuchos_StackedTimer.hpp.
|
inline |
Copy constructor.
Definition at line 238 of file Teuchos_StackedTimer.hpp.
|
inline |
Start a sub timer of a given name, create if doesn't exist
[in] | sub_name | Name of subtimer |
Definition at line 250 of file Teuchos_StackedTimer.hpp.
|
inline |
Stop the current running timer. The timer name is required to verify that you are stopping the current running timer and will error out if the names don't match
[in] | name | the name of the timer you want to stop, used for matching start only |
Definition at line 267 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the full name of the timer with each level split by :
Definition at line 279 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the number of timers on this level
Definition at line 295 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the time spent at a given level
[in] | locate_name | name of subtimer, if blank return current level time |
Definition at line 313 of file Teuchos_StackedTimer.hpp.
|
inline |
Returns the level of the timer in the stack.
Definition at line 335 of file Teuchos_StackedTimer.hpp.
|
inlineprotected |
split a string into two parts split by a '@' if no '@' first gets the full string
[in] | locate_name | input string to split |
[out] | first_name | Part of string before the first '@' |
[out] | second_name | part of string after the first '@' |
Definition at line 345 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the time spent per update at a given level
[in] | locate_name | name of subtimer, if blank return current level time |
Definition at line 362 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the time spent per timer start/stop pair at a given level
[in] | locate_name | name of subtimer, if blank return current level time |
Definition at line 381 of file Teuchos_StackedTimer.hpp.
void Teuchos::StackedTimer::LevelTimer::pack | ( | ) |
Pack up all the levels into a buffer and mpi send to rank 0
LevelTimer* Teuchos::StackedTimer::LevelTimer::unpack | ( | unsigned | from | ) |
Unpack the level timer stack from a mpi recv
[in] | from | rank you are sending from |
void Teuchos::StackedTimer::LevelTimer::report | ( | std::ostream & | os | ) |
Dump the timer stats in a pretty format to ostream
[in,out] | os | Where are you dumping the stats, stdout?? |
Definition at line 33 of file Teuchos_StackedTimer.cpp.
const BaseTimer * Teuchos::StackedTimer::LevelTimer::findBaseTimer | ( | const std::string & | name | ) | const |
Return pointer to the BaseTimer corresponding to a given string
name | input string to search for |
Definition at line 51 of file Teuchos_StackedTimer.cpp.
BaseTimer::TimeInfo Teuchos::StackedTimer::LevelTimer::findTimer | ( | const std::string & | name, |
bool & | found | ||
) |
Return the time info for a given string
name | input string to search for |
set | to true on exit if timer was found |
Definition at line 67 of file Teuchos_StackedTimer.cpp.