40#ifndef TEUCHOS_PERFORMANCEMONITORBASE_H
41#define TEUCHOS_PERFORMANCEMONITORBASE_H
49#include "Teuchos_Comm.hpp"
91 const Array<std::string>& localNames,
92 Array<std::string>& globalNames,
107 Array<std::string>& globalNames,
159 : counter_(
counter_in), isRecursiveCall_(counter_.isRunning())
162 counter_.incrementNumCalls ();
200 static void freeTableFormat () {
201 if (format_ !=
nullptr) {
216 static void freeCounters () {
217 if (counters_ !=
nullptr) {
234 if (format_ ==
nullptr) {
240 static_cast<void>(
atexit(freeTableFormat) );
243 format_ ==
nullptr, std::logic_error,
"Teuchos::PerformanceMonitorBase::"
244 "format: Should never get here! format_ is nullptr.");
294 if (counters_ ==
nullptr) {
295 counters_ =
new std::map<std::string, RCP<T> > ();
300 static_cast<void>(
atexit(freeCounters) );
303 counters_ ==
nullptr, std::logic_error,
"Teuchos::PerformanceMonitorBase::"
304 "counters: Should never get here! counters_ is nullptr.");
314 static std::map<std::string, RCP<T> >* counters_;
320 bool isRecursiveCall_;
325 PerformanceMonitorBase<T>::format_ =
nullptr;
328 std::map<std::string, RCP<T> >*
329 PerformanceMonitorBase<T>::counters_ =
nullptr;
335 typedef std::map<std::string, RCP<T> > map_type;
336 typedef typename map_type::iterator
iter_type;
338 map_type&
ctrs = counters ();
343#ifdef HAVE_TEUCHOS_DEBUG
347 "getNewCounter: insert() claims that timer \"" << name <<
"\" was "
348 "already there in the map, even though find() claims that it was not. "
349 "Please report this bug to the Teuchos developers.");
356#ifdef HAVE_TEUCHOS_DEBUG
359 "getNewCounter: Timer \"" << name <<
"\" was already there in the map, "
360 "but looking it up by name resulted in a null timer. "
361 "Please report this bug to the Teuchos developers.");
363 name !=
it->second->name (), std::logic_error,
364 "getNewCounter: Timer \"" << name <<
"\" was already there in the map, "
365 "but looking it up by name resulted in a timer with a different name \""
366 <<
it->second->name () <<
"\". Please report this bug to the Teuchos "
371#ifdef HAVE_TEUCHOS_DEBUG
374 "getNewCounter: At end of method, when creating timer \"" << name
375 <<
"\", newCounter is null. Please report this bug to the Teuchos "
385 typedef std::map<std::string, RCP<T> > map_type;
386 typedef typename map_type::iterator
iter_type;
388 map_type&
ctrs = counters ();
401 counters ().erase (name);
408 counters ().clear ();
Templated array class derived from the STL std::vector.
Teuchos header file which uses auto-configuration information to include necessary C++ headers.
Reference-counted pointer class and non-member templated function implementations.
Smart reference counting pointer class for automatic garbage collection.
RCP(ENull null_arg=null)
Initialize RCP<T> to NULL.
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object.
bool is_null() const
Returns true if the underlying pointer is null.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
ECounterSetOp
Set operation type for mergeCounterNames() to perform.
void mergeCounterNames(const Comm< int > &comm, const Array< std::string > &localNames, Array< std::string > &globalNames, const ECounterSetOp setOp)
Merge counter names over all processors.
void unsortedMergePair(const Array< std::string > &localNames, Array< std::string > &globalNames, const ECounterSetOp setOp)