tk::Timer class

Timer is a simple class to do timing various parts of the code in a portable way. The functionality is intended to be very minimal and simple, but still convenient to use, with as little state as possible.

Public types

struct Watch
Watch stores time in hours:minutes:seconds.

Constructors, destructors, conversion operators

Timer() explicit
Constructor: initialize clock to current time stamp.

Public functions

void zero()
Zero timer.
auto dsec() const -> real
auto hms() const -> Watch
Query time in second since the constructor call.
void eta(real term, real time, uint64_t nstep, uint64_t it, Watch& elapsedWatch, Watch& estimatedWatch) const
Estimate time for accomplishment.

Pack/Unpack: Serialize Timer object for Charm++

void pup(PUP::er& p)
void operator|(PUP::er& p, Timer& t)
Pack/Unpack serialize operator|.

Function documentation

real tk::Timer::dsec() const

Returns Time elapsed between start and stop as a real number

Query time in second since the constructor call.

Watch tk::Timer::hms() const

Query time in second since the constructor call.

Returns Time elapsed between start and stop as hours, minutes, and seconds, as a Watch struct.

void tk::Timer::eta(real term, real time, uint64_t nstep, uint64_t it, Watch& elapsedWatch, Watch& estimatedWatch) const

Estimate time for accomplishment.

Parameters
term in Time at which to terminate time stepping
time in Current time
nstep in Max number of time steps to take
it in Current iteration count
elapsedWatch out Elapsed time in h:m:s
estimatedWatch out Estimated time for accomplishmet in h:m:s

void tk::Timer::pup(PUP::er& p)

Parameters
in/out Charm++'s PUP::er serializer object reference

Pack/Unpack serialize member function

void tk::Timer::operator|(PUP::er& p, Timer& t)

Pack/Unpack serialize operator|.

Parameters
in/out Charm++'s PUP::er serializer object reference
in/out Timer object reference