Geophysical Inversion and Modelling Library v1.5.4
Loading...
Searching...
No Matches
GIMLI::Stopwatch Class Reference
+ Collaboration diagram for GIMLI::Stopwatch:

Public Member Functions

 Stopwatch (bool start=true)
 
void start ()
 
void stop (bool verbose=false)
 
void restart ()
 
void reset ()
 
double duration (bool restart=false)
 
size_t cycles (bool restart=false)
 
const CycleCountercycleCounter () const
 
void store (bool restart=false)
 
const RVectorstored () const
 

Protected Types

enum  watchstate { undefined , halted , running }
 

Protected Attributes

enum GIMLI::Stopwatch::watchstate _state
 
std::chrono::time_point< std::chrono::high_resolution_clock > _start
 
std::chrono::time_point< std::chrono::high_resolution_clock > _stop
 
RVector_store
 
CycleCounter _cCounter
 

Member Function Documentation

◆ cycles()

size_t GIMLI::Stopwatch::cycles ( bool restart = false)

Returns the cpu cycles. Optional you can restart the stopwatch.

References cycles(), and restart().

Referenced by cycles().

◆ duration()

double GIMLI::Stopwatch::duration ( bool restart = false)

◆ reset()

void GIMLI::Stopwatch::reset ( )

Reset the stopwatch, and delete stored values.

References reset(), and restart().

Referenced by reset().

◆ restart()

void GIMLI::Stopwatch::restart ( )

Restart the stopwatch.

References restart().

Referenced by cycles(), duration(), reset(), restart(), and store().

◆ store()

void GIMLI::Stopwatch::store ( bool restart = false)

Save current duration value into store. Reset current time if needed to store relative times.

References duration(), restart(), and store().

Referenced by store().

◆ stored()

const RVector & GIMLI::Stopwatch::stored ( ) const
inline

Get stored duration values.