Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
Teuchos::BaseTimer Class Reference

the basic timer used elsewhere, uses MPI_Wtime for time More...

#include <Teuchos_StackedTimer.hpp>

Inheritance diagram for Teuchos::BaseTimer:
Inheritance graph
[legend]

Classes

struct  TimeInfo
 

Public Types

using Clock = std::chrono::high_resolution_clock
 

Public Member Functions

 BaseTimer ()
 
void start ()
 Start a currently stopped timer. More...
 
void stop ()
 Stop a current running timer and accumulate time difference. More...
 
unsigned long long incrementUpdates (unsigned long long count=1)
 Increment the total number of items updated between a start stop. More...
 
double accumulatedTime () const
 Get the total accumulated time since last reset or construction when the timer is running. More...
 
void setAccumulatedTime (double accum=0)
 Setter for accumulated time. More...
 
double accumulatedTimePerUpdate () const
 return the average time per item updated More...
 
double accumulatedTimePerTimerCall () const
 return the average time per timer start/stop More...
 
double difference (const BaseTimer &from) const
 Return the difference between two timers in seconds,. More...
 
void reset ()
 Reset all the timer stats, throws if it is already running. More...
 
bool running () const
 Returns true if the timer is currently accumulating time. More...
 
unsigned long numCalls () const
 Returns the number of calls to start(). More...
 
unsigned long long numUpdates () const
 Returns the number of updates added to this timer. More...
 
void overrideNumCallsForUnitTesting (const unsigned long num_calls)
 Sets the number of calls to start() for this timer. This is only used for unit testing. More...
 
void overrideNumUpdatesForUnitTesting (const unsigned long long num_updates)
 Sets the number of counts for this timer. This is only used for unit testing. More...
 

Protected Attributes

double accumulation_
 
unsigned long count_started_
 
unsigned long long count_updates_
 
Clock::time_point start_time_
 
bool running_
 

Friends

struct TimeInfo
 

Detailed Description

the basic timer used elsewhere, uses MPI_Wtime for time

This class hold a time and number of times this timer is called, and a count of how many "updates" this timer has services. Example if you have a mesh of 100 elements your count might be 7, but total iterations would be 700 this number is useful for dynamic systems where the total number of items services might change in time

Definition at line 83 of file Teuchos_StackedTimer.hpp.

Member Typedef Documentation

using Teuchos::BaseTimer::Clock = std::chrono::high_resolution_clock

Definition at line 87 of file Teuchos_StackedTimer.hpp.

Constructor & Destructor Documentation

Teuchos::BaseTimer::BaseTimer ( )
inline

Definition at line 89 of file Teuchos_StackedTimer.hpp.

Member Function Documentation

void Teuchos::BaseTimer::start ( )
inline

Start a currently stopped timer.

Definition at line 92 of file Teuchos_StackedTimer.hpp.

void Teuchos::BaseTimer::stop ( )
inline

Stop a current running timer and accumulate time difference.

Definition at line 102 of file Teuchos_StackedTimer.hpp.

unsigned long long Teuchos::BaseTimer::incrementUpdates ( unsigned long long  count = 1)
inline

Increment the total number of items updated between a start stop.

Definition at line 110 of file Teuchos_StackedTimer.hpp.

double Teuchos::BaseTimer::accumulatedTime ( ) const
inline

Get the total accumulated time since last reset or construction when the timer is running.

Definition at line 113 of file Teuchos_StackedTimer.hpp.

void Teuchos::BaseTimer::setAccumulatedTime ( double  accum = 0)
inline

Setter for accumulated time.

Definition at line 116 of file Teuchos_StackedTimer.hpp.

double Teuchos::BaseTimer::accumulatedTimePerUpdate ( ) const
inline

return the average time per item updated

This returns the time on average that the code spends updating an iteration. If it is running than it will not include the current time. It differs from accumulatedTimePerTimerCall in that it is meant to be timer per event other that start/stop, like mesh update

Returns
average time per iteration pair

Definition at line 126 of file Teuchos_StackedTimer.hpp.

double Teuchos::BaseTimer::accumulatedTimePerTimerCall ( ) const
inline

return the average time per timer start/stop

This returns the time on average that the code spends between a call to start and stop. If it is running than it will not include the current time

Returns
average time per start/stop pair

Definition at line 142 of file Teuchos_StackedTimer.hpp.

double Teuchos::BaseTimer::difference ( const BaseTimer from) const
inline

Return the difference between two timers in seconds,.

Parameters
[in]fromreference time you are computing difference from
Returns
my time - from times

Definition at line 156 of file Teuchos_StackedTimer.hpp.

void Teuchos::BaseTimer::reset ( )
inline

Reset all the timer stats, throws if it is already running.

Definition at line 161 of file Teuchos_StackedTimer.hpp.

bool Teuchos::BaseTimer::running ( ) const
inline

Returns true if the timer is currently accumulating time.

Definition at line 169 of file Teuchos_StackedTimer.hpp.

unsigned long Teuchos::BaseTimer::numCalls ( ) const
inline

Returns the number of calls to start().

Definition at line 172 of file Teuchos_StackedTimer.hpp.

unsigned long long Teuchos::BaseTimer::numUpdates ( ) const
inline

Returns the number of updates added to this timer.

Definition at line 175 of file Teuchos_StackedTimer.hpp.

void Teuchos::BaseTimer::overrideNumCallsForUnitTesting ( const unsigned long  num_calls)
inline

Sets the number of calls to start() for this timer. This is only used for unit testing.

Definition at line 178 of file Teuchos_StackedTimer.hpp.

void Teuchos::BaseTimer::overrideNumUpdatesForUnitTesting ( const unsigned long long  num_updates)
inline

Sets the number of counts for this timer. This is only used for unit testing.

Definition at line 182 of file Teuchos_StackedTimer.hpp.

Friends And Related Function Documentation

friend struct TimeInfo
friend

Definition at line 201 of file Teuchos_StackedTimer.hpp.

Member Data Documentation

double Teuchos::BaseTimer::accumulation_
protected

Definition at line 195 of file Teuchos_StackedTimer.hpp.

unsigned long Teuchos::BaseTimer::count_started_
protected

Definition at line 196 of file Teuchos_StackedTimer.hpp.

unsigned long long Teuchos::BaseTimer::count_updates_
protected

Definition at line 197 of file Teuchos_StackedTimer.hpp.

Clock::time_point Teuchos::BaseTimer::start_time_
protected

Definition at line 198 of file Teuchos_StackedTimer.hpp.

bool Teuchos::BaseTimer::running_
protected

Definition at line 199 of file Teuchos_StackedTimer.hpp.


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