42 #ifndef TEUCHOS_PERFORMANCEMONITORBASE_H
43 #define TEUCHOS_PERFORMANCEMONITORBASE_H
94 const Array<std::string>& localNames,
95 Array<std::string>& globalNames,
110 Array<std::string>& globalNames,
243 format_ == NULL, std::logic_error,
"Teuchos::PerformanceMonitorBase::"
244 "format: Should never get here! format_ is NULL.");
293 static TEUCHOS_DEPRECATED
void clearTimer (
const std::string& name);
318 counters_ =
new std::map<std::string, RCP<T> > ();
326 counters_ == NULL, std::logic_error,
"Teuchos::PerformanceMonitorBase::"
327 "counters: Should never get here! counters_ is NULL.");
351 std::map<std::string, RCP<T> >*
358 typedef std::map<std::string, RCP<T> > map_type;
359 typedef typename map_type::iterator iter_type;
361 map_type& ctrs = counters ();
362 iter_type it = ctrs.find (name);
364 if (it == ctrs.end ()) {
365 newCounter =
rcp (
new T (name));
366 #ifdef HAVE_TEUCHOS_DEBUG
367 const bool wasNotThere = ctrs.insert (std::make_pair (name, newCounter)).second;
369 ! wasNotThere, std::logic_error,
370 "getNewCounter: insert() claims that timer \"" << name <<
"\" was "
371 "already there in the map, even though find() claims that it was not. "
372 "Please report this bug to the Teuchos developers.");
375 ctrs.insert (it, std::make_pair (name, newCounter));
376 #endif // HAVE_TEUCHOS_DEBUG
378 newCounter = it->second;
379 #ifdef HAVE_TEUCHOS_DEBUG
381 it->second.is_null (), std::logic_error,
382 "getNewCounter: Timer \"" << name <<
"\" was already there in the map, "
383 "but looking it up by name resulted in a null timer. "
384 "Please report this bug to the Teuchos developers.");
386 name != it->second->name (), std::logic_error,
387 "getNewCounter: Timer \"" << name <<
"\" was already there in the map, "
388 "but looking it up by name resulted in a timer with a different name \""
389 << it->second->name () <<
"\". Please report this bug to the Teuchos "
391 #endif // HAVE_TEUCHOS_DEBUG
394 #ifdef HAVE_TEUCHOS_DEBUG
396 newCounter.
is_null (), std::logic_error,
397 "getNewCounter: At end of method, when creating timer \"" << name
398 <<
"\", newCounter is null. Please report this bug to the Teuchos "
400 #endif // HAVE_TEUCHOS_DEBUG
408 typedef std::map<std::string, RCP<T> > map_type;
409 typedef typename map_type::iterator iter_type;
411 map_type& ctrs = counters ();
412 iter_type it = ctrs.find (name);
413 if (it == ctrs.end ()) {
424 counters ().erase (name);
445 counters ().clear ();
450 #endif // TEUCHOS_PERFORMANCEMONITORBASE_H
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
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)
Templated array class derived from the STL std::vector.
Smart reference counting pointer class for automatic garbage collection.
ECounterSetOp
Set operation type for mergeCounterNames() to perform.
Reference-counted pointer class and non-member templated function implementations.
bool is_null() const
Returns true if the underlying pointer is null.