shark::Timer Class Reference

Timer abstraction with microsecond resolution. More...

#include <shark/Core/Timer.h>

Public Member Functions

 Timer (bool measureWallclockTime=true)
 
void start ()
 Stores the current time in m_startTime. More...
 
double stop ()
 Returns the difference between current time and the start time. More...
 
double lastLap ()
 Returns the last value of stop(). More...
 

Static Public Member Functions

static double now (bool measureWallclockTime=true)
 Returns the current time in a microsecond resolution. Att: may in rare cases give decreasing values. More...
 

Detailed Description

Timer abstraction with microsecond resolution.

Use start() to start the timer and stop() to retrive the elapsed time in seconds (guaranteed/forced to be >= 0 ). Use now() to get the current time (may in rare cases give decreasing values).

Definition at line 56 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer()

shark::Timer::Timer ( bool  measureWallclockTime = true)
inline

Definition at line 59 of file Timer.h.

References start().

Member Function Documentation

◆ lastLap()

double shark::Timer::lastLap ( )
inline

Returns the last value of stop().

Definition at line 119 of file Timer.h.

◆ now()

static double shark::Timer::now ( bool  measureWallclockTime = true)
inlinestatic

Returns the current time in a microsecond resolution. Att: may in rare cases give decreasing values.

Definition at line 66 of file Timer.h.

Referenced by shark::QpSolver< Problem, SelectionStrategy >::solve(), shark::BiasSolver< Matrix >::solve(), shark::BiasSolverSimplex< Matrix >::solve(), start(), and stop().

◆ start()

void shark::Timer::start ( )
inline

Stores the current time in m_startTime.

Definition at line 97 of file Timer.h.

References now().

Referenced by shark::QpMcLinear< InputT >::solve(), and Timer().

◆ stop()

double shark::Timer::stop ( )
inline

Returns the difference between current time and the start time.

The time is meeasured since the last time start() was called. Thus several consecutive calls to stop() will return ascending numbers. start() is called automatically at construction time.

Definition at line 105 of file Timer.h.

References now().

Referenced by main(), and run().


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