Teuchos::PerformanceMonitorBase< T > Class Template Reference

Provides common capabilities for collecting and reporting performance data across processors. More...

#include <Teuchos_PerformanceMonitorBase.hpp>

Inheritance diagram for Teuchos::PerformanceMonitorBase< T >:
Inheritance graph
[legend]

List of all members.

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 TableFormatformat ()
 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.

Private Attributes

T & counter_
bool isRecursiveCall_

Detailed Description

template<class T>
class Teuchos::PerformanceMonitorBase< T >

Provides common capabilities for collecting and reporting performance data across processors.

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.


Constructor & Destructor Documentation

template<class T>
Teuchos::PerformanceMonitorBase< T >::PerformanceMonitorBase ( T &  counter_in,
bool  reset = false 
) [inline]

Construct with a counter.

Definition at line 81 of file Teuchos_PerformanceMonitorBase.hpp.

template<class T>
virtual Teuchos::PerformanceMonitorBase< T >::~PerformanceMonitorBase (  )  [inline, virtual]

The dtor for the base class does nothing.

Definition at line 89 of file Teuchos_PerformanceMonitorBase.hpp.


Member Function Documentation

template<class T>
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.

template<class T>
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.

template<class T>
const T& Teuchos::PerformanceMonitorBase< T >::counter (  )  const [inline, protected]

Access to the counter.

Definition at line 116 of file Teuchos_PerformanceMonitorBase.hpp.

template<class T>
T& Teuchos::PerformanceMonitorBase< T >::counter (  )  [inline, protected]

Access to the counter.

Definition at line 119 of file Teuchos_PerformanceMonitorBase.hpp.

template<class T>
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.

template<class T>
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.


Member Data Documentation

template<class T>
T& Teuchos::PerformanceMonitorBase< T >::counter_ [private]

Definition at line 137 of file Teuchos_PerformanceMonitorBase.hpp.

template<class T>
bool Teuchos::PerformanceMonitorBase< T >::isRecursiveCall_ [private]

Definition at line 139 of file Teuchos_PerformanceMonitorBase.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 09:57:38 2011 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.3