Teuchos - Trilinos Tools Package Version of the Day
Classes | Namespaces | Defines
Teuchos_TimeMonitor.hpp File Reference

Timer class that starts when constructed and stops when the destructor is called. More...

#include "Teuchos_ConfigDefs.hpp"
#include "Teuchos_PerformanceMonitorBase.hpp"
#include "Teuchos_Time.hpp"

Go to the source code of this file.

Classes

class  Teuchos::TimeMonitor
 A timer class that starts when constructed and stops when the destructor is called. More...

Namespaces

namespace  Teuchos
 

The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.


Defines

#define TEUCHOS_TIMER(funcName, strName)
 Defines a static non-member function that returns a time monitor.
#define TEUCHOS_FUNC_TIME_MONITOR_DIFF(FUNCNAME, DIFF)
 Defines a timer for a specific function (with differentiator).
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)   TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, main )
 Defines a timer for a specific function.

Detailed Description

Timer class that starts when constructed and stops when the destructor is called.

Definition in file Teuchos_TimeMonitor.hpp.


Define Documentation

#define TEUCHOS_TIMER (   funcName,
  strName 
)
Value:
static Teuchos::Time& funcName() \
  {static Teuchos::RCP<Time> rtn = \
      Teuchos::TimeMonitor::getNewCounter(strName); return *rtn;}

Defines a static non-member function that returns a time monitor.

Definition at line 52 of file Teuchos_TimeMonitor.hpp.

#define TEUCHOS_FUNC_TIME_MONITOR_DIFF (   FUNCNAME,
  DIFF 
)
Value:
static Teuchos::RCP<Teuchos::Time> DIFF ## blabla_localTimer; \
  if(!DIFF ## blabla_localTimer.get()) { \
    std::ostringstream oss; \
    oss << FUNCNAME; \
    DIFF ## blabla_localTimer = Teuchos::TimeMonitor::getNewCounter(oss.str()); \
  } \
  Teuchos::TimeMonitor DIFF ## blabla_localTimeMonitor(*DIFF ## blabla_localTimer)

Defines a timer for a specific function (with differentiator).

Same as TEUCHOS_FUNC_TIME_MONITOR(...) except required when used more than once in the same function (like a block of code).

Definition at line 63 of file Teuchos_TimeMonitor.hpp.

#define TEUCHOS_FUNC_TIME_MONITOR (   FUNCNAME)    TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, main )

Defines a timer for a specific function.

Note that the name of the timer can be formated with stream inserts. For example, we can define a time monitor for a function as follows:

 template<typename Scalar>
 void foo()
 {
 TEUCHOS_FUNC_TIME_MONITOR(
 "foo<"<<Teuchos::ScalarTraits<Scalar>::name()<<">()"
 );
 ...
 }

The timer can then be printed at the end of the program using

Definition at line 100 of file Teuchos_TimeMonitor.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines