MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu::MutuallyExclusiveTime< TagName > Class Template Reference

This class wraps a Teuchos::Time and maintains a mutually exclusive property between wrapped timers. More...

#include <MueLu_MutuallyExclusiveTime.hpp>

Inheritance diagram for MueLu::MutuallyExclusiveTime< TagName >:
MueLu::BaseClass MueLu::VerboseObject MueLu::Describable

Query methods.

std::string name_
 Name of this mutually exclusive timer.
bool isRunning ()
bool isPaused ()
void incrementNumCalls ()
 Increment the number of times this timer has been called.
static RCP< MutuallyExclusiveTime< TagName > > getNewTimer (const std::string &name)
 Return a new MutuallyExclusiveTime that is registered with the Teuchos::TimeMonitor (for timer summary).

Constructor/Destructor

 MutuallyExclusiveTime (const std::string &name, bool startFlag=false)
 Constructor.
 ~MutuallyExclusiveTime ()
 Destructor.
void start (bool reset=false)
 Starts the timer. If a MutuallyExclusiveTime timer is running, it will be stopped.

Functions that can only be called on the most recent timer (i.e., the running or last paused timer)

double stop ()
 Stops the timer. The previous MutuallyExclusiveTime that has been paused when this timer was started will be resumed. This method can be called on an already stopped timer or on the currently running timer.
void pause ()
 Pause running timer. Used internally by start().
void resume ()
 Resume paused timer. Used internally by stop(). Timer is not reset.

Additional Inherited Members

virtual ~BaseClass ()
 Destructor.
 VerboseObject ()
virtual ~VerboseObject ()
 Destructor.
VerbLevel GetVerbLevel () const
 Get the verbosity level.
void SetVerbLevel (const VerbLevel verbLevel)
 Set the verbosity level of this object.
int GetProcRankVerbose () const
 Get proc rank used for printing. Do not use this information for any other purpose..
int SetProcRankVerbose (int procRank) const
 Set proc rank used for printing.
bool IsPrint (MsgType type, int thisProcRankOnly=-1) const
 Find out whether we need to print out information for a specific message type.
Teuchos::FancyOStream & GetOStream (MsgType type, int thisProcRankOnly=0) const
 Get an output stream for outputting the input message type.
Teuchos::FancyOStream & GetBlackHole () const
Public Member Functions inherited from MueLu::Describable
virtual ~Describable ()
 Destructor.
virtual void describe (Teuchos::FancyOStream &out_arg, const VerbLevel verbLevel=Default) const
virtual std::string description () const
 Return a simple one-line description of this object.
void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Print the object with some verbosity level to an FancyOStream object.
virtual std::string ShortClassName () const
 Return the class name of the object, without template parameters and without namespace.
static void SetDefaultVerbLevel (const VerbLevel defaultVerbLevel)
 Set the default (global) verbosity level.
static VerbLevel GetDefaultVerbLevel ()
 Get the default (global) verbosity level.
static void SetMueLuOStream (const Teuchos::RCP< Teuchos::FancyOStream > &mueluOStream)
static void SetMueLuOFileStream (const std::string &filename)
static Teuchos::RCP< Teuchos::FancyOStream > GetMueLuOStream ()

Detailed Description

template<class TagName>
class MueLu::MutuallyExclusiveTime< TagName >

This class wraps a Teuchos::Time and maintains a mutually exclusive property between wrapped timers.

This class is useful to exclude from a timer the execution time of a subroutine; when a MutuallyExclusiveTime is running, other timers are not running. Timers have three states (running, stopped, paused) to enforce the mutually exclusive property. When the running timer is stopped, the last active timer is restarted. A stack of timers is used internally to support this functionality. The template parameter of this class can be used to define several sets of mutually exclusive timers.

Note: Only one timer can be active at a time but all timers can be inactive at the same time. Timers cannot be destroyed when they are in 'paused'.

Todo
inheritence from PerformanceMonitorBase<Time> ?

Definition at line 39 of file MueLu_MutuallyExclusiveTime.hpp.

Constructor & Destructor Documentation

◆ MutuallyExclusiveTime()

template<class TagName>
MueLu::MutuallyExclusiveTime< TagName >::MutuallyExclusiveTime ( const std::string & name,
bool startFlag = false )

Constructor.

Definition at line 31 of file MueLu_MutuallyExclusiveTime.cpp.

◆ ~MutuallyExclusiveTime()

template<class TagName>
MueLu::MutuallyExclusiveTime< TagName >::~MutuallyExclusiveTime ( )

Destructor.

Definition at line 41 of file MueLu_MutuallyExclusiveTime.cpp.

Member Function Documentation

◆ start()

template<class TagName>
void MueLu::MutuallyExclusiveTime< TagName >::start ( bool reset = false)

Starts the timer. If a MutuallyExclusiveTime timer is running, it will be stopped.

Precondition
Timer is not already paused.
Postcondition
Timer is running. Other MutuallyExclusiveTime timers are paused or stopped.

Definition at line 53 of file MueLu_MutuallyExclusiveTime.cpp.

◆ stop()

template<class TagName>
double MueLu::MutuallyExclusiveTime< TagName >::stop ( )

Stops the timer. The previous MutuallyExclusiveTime that has been paused when this timer was started will be resumed. This method can be called on an already stopped timer or on the currently running timer.

Definition at line 78 of file MueLu_MutuallyExclusiveTime.cpp.

◆ pause()

template<class TagName>
void MueLu::MutuallyExclusiveTime< TagName >::pause ( )

Pause running timer. Used internally by start().

Definition at line 101 of file MueLu_MutuallyExclusiveTime.cpp.

◆ resume()

template<class TagName>
void MueLu::MutuallyExclusiveTime< TagName >::resume ( )

Resume paused timer. Used internally by stop(). Timer is not reset.

Precondition
Timer is at the top of the stack.

Definition at line 112 of file MueLu_MutuallyExclusiveTime.cpp.

◆ isRunning()

template<class TagName>
bool MueLu::MutuallyExclusiveTime< TagName >::isRunning ( )

Definition at line 124 of file MueLu_MutuallyExclusiveTime.cpp.

◆ isPaused()

template<class TagName>
bool MueLu::MutuallyExclusiveTime< TagName >::isPaused ( )

Definition at line 133 of file MueLu_MutuallyExclusiveTime.cpp.

◆ getNewTimer()

template<class TagName>
RCP< MutuallyExclusiveTime< TagName > > MueLu::MutuallyExclusiveTime< TagName >::getNewTimer ( const std::string & name)
static

Return a new MutuallyExclusiveTime that is registered with the Teuchos::TimeMonitor (for timer summary).

Definition at line 139 of file MueLu_MutuallyExclusiveTime.cpp.

◆ incrementNumCalls()

template<class TagName>
void MueLu::MutuallyExclusiveTime< TagName >::incrementNumCalls ( )

Increment the number of times this timer has been called.

Definition at line 146 of file MueLu_MutuallyExclusiveTime.cpp.

Member Data Documentation

◆ name_

template<class TagName>
std::string MueLu::MutuallyExclusiveTime< TagName >::name_

Name of this mutually exclusive timer.

Definition at line 91 of file MueLu_MutuallyExclusiveTime.hpp.


The documentation for this class was generated from the following files: