Teuchos::TimeMonitor Class Reference

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

#include <Teuchos_TimeMonitor.hpp>

Inheritance diagram for Teuchos::TimeMonitor:

Teuchos::PerformanceMonitorBase< T > List of all members.

Public Member Functions

Constructor/Destructor
 TimeMonitor (Time &timer, bool reset=false)
 Constructor starts timer.
 ~TimeMonitor ()
 Destructor causes timer to stop.

Static Public Member Functions

Static functions
static Teuchos::RCP< TimegetNewTimer (const std::string &name)
 Wrapping of getNewCounter() for backwards compatibiity with old code.
static void zeroOutTimers ()
 Reset the global timers to zero.
static void summarize (std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true)
 Print summary statistics for a group of timers.

Detailed Description

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

Termination upon destruction lets this timer behave correctly even if scope is exited because of an std::exception.

NOTE: It is critical that this class only be used to time functions that are called only within the main program and not at pre-program setup or post-program teardown!

Note:
Teuchos::TimeMonitor uses the Teuchos::Time class internally.
Examples:

TimeMonitor/cxx_main.cpp.

Definition at line 119 of file Teuchos_TimeMonitor.hpp.


Constructor & Destructor Documentation

Teuchos::TimeMonitor::TimeMonitor ( Time timer,
bool  reset = false 
) [inline]

Constructor starts timer.

Definition at line 127 of file Teuchos_TimeMonitor.hpp.

Teuchos::TimeMonitor::~TimeMonitor (  )  [inline]

Destructor causes timer to stop.

Definition at line 134 of file Teuchos_TimeMonitor.hpp.


Member Function Documentation

static Teuchos::RCP<Time> Teuchos::TimeMonitor::getNewTimer ( const std::string &  name  )  [inline, static]

Wrapping of getNewCounter() for backwards compatibiity with old code.

Definition at line 147 of file Teuchos_TimeMonitor.hpp.

void Teuchos::TimeMonitor::zeroOutTimers (  )  [static]

Reset the global timers to zero.

Preconditions:

Definition at line 39 of file Teuchos_TimeMonitor.cpp.

void Teuchos::TimeMonitor::summarize ( std::ostream &  out = std::cout,
const bool  alwaysWriteLocal = false,
const bool  writeGlobalStats = true,
const bool  writeZeroTimers = true 
) [static]

Print summary statistics for a group of timers.

Timings are gathered from all processors

Note:
This method must be called by all processors

Definition at line 62 of file Teuchos_TimeMonitor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 13 09:23:02 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7