Geophysical Inversion and Modelling Library  v1.5.0
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.

◆ duration()

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

◆ reset()

void GIMLI::Stopwatch::reset ( )

Reset the stopwatch, and delete stored values.

◆ restart()

void GIMLI::Stopwatch::restart ( )

Restart the stopwatch.

◆ store()

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

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

◆ stored()

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

Get stored duration values.