10#ifndef TEUCHOS_PERFORMANCEMONITORBASE_H
11#define TEUCHOS_PERFORMANCEMONITORBASE_H
19#include "Teuchos_Comm.hpp"
61 const Array<std::string>& localNames,
62 Array<std::string>& globalNames,
77 Array<std::string>& globalNames,
129 : counter_(
counter_in), isRecursiveCall_(counter_.isRunning())
132 counter_.incrementNumCalls ();
170 static void freeTableFormat () {
171 if (format_ !=
nullptr) {
186 static void freeCounters () {
187 if (counters_ !=
nullptr) {
204 if (format_ ==
nullptr) {
210 static_cast<void>(
atexit(freeTableFormat) );
213 format_ ==
nullptr, std::logic_error,
"Teuchos::PerformanceMonitorBase::"
214 "format: Should never get here! format_ is nullptr.");
264 if (counters_ ==
nullptr) {
265 counters_ =
new std::map<std::string, RCP<T> > ();
270 static_cast<void>(
atexit(freeCounters) );
273 counters_ ==
nullptr, std::logic_error,
"Teuchos::PerformanceMonitorBase::"
274 "counters: Should never get here! counters_ is nullptr.");
284 static std::map<std::string, RCP<T> >* counters_;
290 bool isRecursiveCall_;
295 PerformanceMonitorBase<T>::format_ =
nullptr;
298 std::map<std::string, RCP<T> >*
299 PerformanceMonitorBase<T>::counters_ =
nullptr;
305 typedef std::map<std::string, RCP<T> > map_type;
306 typedef typename map_type::iterator
iter_type;
308 map_type&
ctrs = counters ();
313#ifdef HAVE_TEUCHOS_DEBUG
317 "getNewCounter: insert() claims that timer \"" << name <<
"\" was "
318 "already there in the map, even though find() claims that it was not. "
319 "Please report this bug to the Teuchos developers.");
326#ifdef HAVE_TEUCHOS_DEBUG
329 "getNewCounter: Timer \"" << name <<
"\" was already there in the map, "
330 "but looking it up by name resulted in a null timer. "
331 "Please report this bug to the Teuchos developers.");
333 name !=
it->second->name (), std::logic_error,
334 "getNewCounter: Timer \"" << name <<
"\" was already there in the map, "
335 "but looking it up by name resulted in a timer with a different name \""
336 <<
it->second->name () <<
"\". Please report this bug to the Teuchos "
341#ifdef HAVE_TEUCHOS_DEBUG
344 "getNewCounter: At end of method, when creating timer \"" << name
345 <<
"\", newCounter is null. Please report this bug to the Teuchos "
355 typedef std::map<std::string, RCP<T> > map_type;
356 typedef typename map_type::iterator
iter_type;
358 map_type&
ctrs = counters ();
371 counters ().erase (name);
378 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< 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)