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< Time > 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
Teuchos::RCP< TimegetNewTimer (const std::string &name)
 Wrapping of getNewCounter() for backwards compatibiity with old code.
void zeroOutTimers ()
 Reset the global timers to zero.
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 110 of file Teuchos_TimeMonitor.hpp.


Constructor & Destructor Documentation

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

Constructor starts timer.

Definition at line 118 of file Teuchos_TimeMonitor.hpp.

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

Destructor causes timer to stop.

Definition at line 125 of file Teuchos_TimeMonitor.hpp.


Member Function Documentation

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

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

Examples:
TimeMonitor/cxx_main.cpp.

Definition at line 138 of file Teuchos_TimeMonitor.hpp.

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

Reset the global timers to zero.

Preconditions:

  • None of the timers must currently be running!

Definition at line 40 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
Examples:
TimeMonitor/cxx_main.cpp.

Definition at line 63 of file Teuchos_TimeMonitor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Jan 8 12:29:52 2009 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1