PSCF v1.1
Public Member Functions | Static Public Member Functions | List of all members
Util::Timer Class Reference

Wall clock timer. More...

#include <Timer.h>

Public Member Functions

 Timer ()
 Default constructor. More...
 
void start (TimePoint begin)
 Start timing from an externally supplied time. More...
 
void start ()
 Start timing from now (internally computed). More...
 
void stop (TimePoint end)
 Stop the clock at an externally supplied time. More...
 
void stop ()
 Stop the clock now (internally supplied). More...
 
bool isRunning ()
 Is this Timer running? More...
 
void clear ()
 Reset accumulated time to zero. More...
 
double time ()
 Return the accumulated time, in seconds. More...
 

Static Public Member Functions

static TimePoint now ()
 Return current time point. More...
 

Detailed Description

Wall clock timer.

A Timer keeps track of the time elapsed during one or more interval. Each interval begins when start() is called and ends when stop() is called. If start() and stop() are invoked repeatedly, the timer accumulates the time elapses in multiple intervals. The accumulated time is returned by the time() method, and can be reset to zero by the clear() method.

Definition at line 34 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer()

Util::Timer::Timer ( )

Default constructor.

Definition at line 30 of file Timer.cpp.

References clear().

Member Function Documentation

◆ start() [1/2]

void Util::Timer::start ( TimePoint  begin)

Start timing from an externally supplied time.

Set start time and set isRunning = true.

Parameters
beginstarting TimePoint.

Definition at line 49 of file Timer.cpp.

References UTIL_THROW.

Referenced by Pscf::Fd1d::BinaryRelaxIterator::solve().

◆ start() [2/2]

void Util::Timer::start ( )

Start timing from now (internally computed).

Set start time and set isRunning = true.

Definition at line 61 of file Timer.cpp.

References now(), and UTIL_THROW.

◆ stop() [1/2]

void Util::Timer::stop ( TimePoint  end)

Stop the clock at an externally supplied time.

Increment accumulated time, set isRunning = false.

Definition at line 73 of file Timer.cpp.

References UTIL_THROW.

Referenced by Pscf::Fd1d::BinaryRelaxIterator::solve().

◆ stop() [2/2]

void Util::Timer::stop ( )
inline

Stop the clock now (internally supplied).

Increment accumulated time, set isRunning = false.

Definition at line 123 of file Timer.h.

References now(), and stop().

Referenced by stop().

◆ isRunning()

bool Util::Timer::isRunning ( )
inline

Is this Timer running?

Definition at line 129 of file Timer.h.

◆ clear()

void Util::Timer::clear ( )

Reset accumulated time to zero.

Definition at line 89 of file Timer.cpp.

Referenced by Timer().

◆ time()

double Util::Timer::time ( )

Return the accumulated time, in seconds.

Definition at line 37 of file Timer.cpp.

Referenced by Pscf::Fd1d::BinaryRelaxIterator::solve().

◆ now()

Timer::TimePoint Util::Timer::now ( )
static

Return current time point.

Definition at line 18 of file Timer.cpp.

Referenced by start(), and stop().


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