Teuchos - Trilinos Tools Package
Version of the Day
|
Common capabilities for collecting and reporting performance data across processors. More...
#include <Teuchos_PerformanceMonitorBase.hpp>
Public Member Functions | |
PerformanceMonitorBase (T &counter_in, bool reset=false) | |
Construct with a counter. More... | |
virtual | ~PerformanceMonitorBase () |
Destructor. More... | |
Static Public Member Functions | |
static RCP< T > | getNewCounter (const std::string &name) |
Create a new counter with the specified name and add it to a global set of counters of this type. More... | |
static TableFormat & | format () |
Table format that will be used to print a summary of timer results. More... | |
static RCP< T > | lookupCounter (const std::string &name) |
Return the first counter with the given name, or null if none. More... | |
static void | clearCounters () |
"Forget" about all counters created with getNewCounter(). More... | |
static TEUCHOS_DEPRECATED void | clearTimers () |
"Forget" about all counters created with getNewCounter(). More... | |
static void | clearCounter (const std::string &name) |
"Forget" about any counters with the given name. More... | |
static TEUCHOS_DEPRECATED void | clearTimer (const std::string &name) |
"Forget" about any counters with the given name. More... | |
Protected Member Functions | |
const T & | counter () const |
Constant access to the instance's counter reference. More... | |
T & | counter () |
Nonconstant access to the instance's counter reference. More... | |
bool | isRecursiveCall () const |
Whether we are currently in a recursive call of the counter. More... | |
Static Protected Member Functions | |
static std::map< std::string, RCP< T > > & | counters () |
Array of all counters that were created with getNewCounter() on the calling (MPI) process. More... | |
Common capabilities for collecting and reporting performance data across processors.
PerformanceMonitorBase is templated on a counter type T (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 may supply additional features.
PerformanceMonitorBase's constructor increments its counter's call count. Subclasses of PerformanceMonitorBase may do more upon construction or destruction; for example, TimeMonitor starts its timer on construction and stops it on destruction.
This 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. Subclasses of PerformanceMonitorBase, such as TimeMonitor, may use this list to do things like compute global timer statistics over all the MPI processes.
PerformanceMonitorBase requires that the counter type T provide at least the following interface:
Definition at line 157 of file Teuchos_PerformanceMonitorBase.hpp.
|
inline |
Construct with a counter.
Definition at line 161 of file Teuchos_PerformanceMonitorBase.hpp.
|
inlinevirtual |
Destructor.
The destructor for the base class does nothing. We provide a virtual destructor for memory safety of derived classes.
Definition at line 172 of file Teuchos_PerformanceMonitorBase.hpp.
|
static |
Create a new counter with the specified name and add it to a global set of counters of this type.
If the counter already exists, just return the existing counter. If the counter doesn't already exist, create a new counter with that name and return it.
New counters should usually be created in this way rather than through a direct constructor call. This lets PerformanceMonitorBase keep track of them, so that methods like summarize() and report() know about them. Timers created in other ways are not included in the reports printed by these methods.
Definition at line 356 of file Teuchos_PerformanceMonitorBase.hpp.
|
inlinestatic |
Table format that will be used to print a summary of timer results.
Definition at line 232 of file Teuchos_PerformanceMonitorBase.hpp.
|
static |
Return the first counter with the given name, or null if none.
It is currently possible to create multiple counters with the same name using getNewCounter()
. If multiple counters with the given name exist, this method simply returns the first in the list. Do not rely on the ability to create multiple counters with the same name; this may go away in the future.
Definition at line 406 of file Teuchos_PerformanceMonitorBase.hpp.
|
static |
"Forget" about all counters created with getNewCounter().
This removes all counters from the current set of counters (as would be returned by counters()).
Definition at line 443 of file Teuchos_PerformanceMonitorBase.hpp.
|
static |
"Forget" about all counters created with getNewCounter().
This removes all counters from the current list of counters (as would be returned by counters()).
Definition at line 436 of file Teuchos_PerformanceMonitorBase.hpp.
|
static |
"Forget" about any counters with the given name.
If one or more counters with the given name was created using getNewCounter(), calling this method with that name will remove them from the global list of counters.
Definition at line 422 of file Teuchos_PerformanceMonitorBase.hpp.
|
static |
"Forget" about any counters with the given name.
If one or more counters with the given name was created using getNewCounter(), calling this method with that name will remove them from the global list of counters.
Definition at line 429 of file Teuchos_PerformanceMonitorBase.hpp.
|
inlineprotected |
Constant access to the instance's counter reference.
Definition at line 298 of file Teuchos_PerformanceMonitorBase.hpp.
|
inlineprotected |
Nonconstant access to the instance's counter reference.
Definition at line 301 of file Teuchos_PerformanceMonitorBase.hpp.
|
inlineprotected |
Whether we are currently in a recursive call of the counter.
Subclasses of PerformanceMonitorBase may use this information to control whether to start or stop the given counter. This matters 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 309 of file Teuchos_PerformanceMonitorBase.hpp.
|
inlinestaticprotected |
Array of all counters that were created with getNewCounter() on the calling (MPI) process.
Definition at line 315 of file Teuchos_PerformanceMonitorBase.hpp.