#include <Teuchos_PerformanceMonitorBase.hpp>
Public Member Functions | |
PerformanceMonitorBase (T &counter_in, bool reset=false) | |
Construct with a counter. | |
virtual | ~PerformanceMonitorBase () |
The dtor for the base class does nothing. | |
Static Public Member Functions | |
static RCP< T > | getNewCounter (const std::string &name) |
Create a new counter with the specified name and append it to a global list of counters of this type. | |
static TableFormat & | format () |
Get the format that will be used to print a summary of results. | |
Protected Member Functions | |
const T & | counter () const |
Access to the counter. | |
T & | counter () |
Access to the counter. | |
bool | isRecursiveCall () const |
Indicate whether the current call is recursive. | |
Static Protected Member Functions | |
static Array< RCP< T > > & | counters () |
Use the "Meyers Trick" to create static data safely. |
PerformanceMonitorBase is templated on a counter type (which might be a timer or a flop counter). The common capability of the counter type is a counter for the number of calls. Derived counter types can supply additional features.
A PerformanceMonitorBase will increment its call counter upon every ctor call. Derived types might do more upon construction or destruction; for example, a timer will start upon construction and stop upon destruction.
The class keeps a static list of all counters created using the getNewCounter() method during the course of a run. Counts from this list can then be printed out at the end of the run.
The minimum requirements on the counter for use in the PerformanceMonitorBase are the following methods:
// add one to number of calls void incrementNumCalls() // return the number of calls int numCalls() const // indicate whether the counter is already running bool isRunning() const
Definition at line 76 of file Teuchos_PerformanceMonitorBase.hpp.
Teuchos::PerformanceMonitorBase< T >::PerformanceMonitorBase | ( | T & | counter_in, | |
bool | reset = false | |||
) | [inline] |
virtual Teuchos::PerformanceMonitorBase< T >::~PerformanceMonitorBase | ( | ) | [inline, virtual] |
The dtor for the base class does nothing.
Definition at line 89 of file Teuchos_PerformanceMonitorBase.hpp.
T& Teuchos::PerformanceMonitorBase< T >::counter | ( | ) | [inline, protected] |
const T& Teuchos::PerformanceMonitorBase< T >::counter | ( | ) | const [inline, protected] |
static Array<RCP<T> >& Teuchos::PerformanceMonitorBase< T >::counters | ( | ) | [inline, static, protected] |
Use the "Meyers Trick" to create static data safely.
Definition at line 129 of file Teuchos_PerformanceMonitorBase.hpp.
static TableFormat& Teuchos::PerformanceMonitorBase< T >::format | ( | ) | [inline, static] |
Get the format that will be used to print a summary of results.
Definition at line 107 of file Teuchos_PerformanceMonitorBase.hpp.
static RCP<T> Teuchos::PerformanceMonitorBase< T >::getNewCounter | ( | const std::string & | name | ) | [inline, static] |
Create a new counter with the specified name and append it to a global list of counters of this type.
New counters should usually be created in this way rather than through a direct ctor call so that they can be appended to the list.
Definition at line 97 of file Teuchos_PerformanceMonitorBase.hpp.
bool Teuchos::PerformanceMonitorBase< T >::isRecursiveCall | ( | ) | const [inline, protected] |
Indicate whether the current call is recursive.
This can matter in cases such as timing where we don't want to start and stop timers multiple times within a single call stack.
Definition at line 126 of file Teuchos_PerformanceMonitorBase.hpp.