Biorbd Release_1.13.0
Loading...
Searching...
No Matches
BIORBD_NAMESPACE::utils::Timer Class Reference

Wrapper around timer function in C++. More...

#include <Timer.h>

Public Member Functions

 Timer (bool startNow=false)
 Construct timer.
void start ()
 Start the timer.
bool isStarted ()
 Return if the timer is started.
void pause ()
 Pause the timer.
void resume ()
 Resume the timer. If it is paused, it adds a lap.
double getLap ()
 Get the lap time of a running timer. Return 0 if the timer is not running.
double stop ()
 Stop the timer and return the lap time.

Protected Member Functions

void addPauseTime ()
 Add a pause to the timer time (total time being execution time - pause time).
double getTime (const std::clock_t &timer)
 Get the time spent until start.

Protected Attributes

bool m_isStarted
 If the timer is started.
bool m_isPaused
 If the timer is paused.
std::clock_t m_start
 The start time.
std::clock_t m_pauseTime
 The pause time.
double m_totalPauseTime
 The total pause time.

Detailed Description

Wrapper around timer function in C++.

Definition at line 15 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer()

utils::Timer::Timer ( bool startNow = false)

Construct timer.

Parameters
startNowIf the timer should start now

Definition at line 6 of file Timer.cpp.

Member Function Documentation

◆ addPauseTime()

void utils::Timer::addPauseTime ( )
protected

Add a pause to the timer time (total time being execution time - pause time).

Definition at line 63 of file Timer.cpp.

◆ getLap()

double utils::Timer::getLap ( )

Get the lap time of a running timer. Return 0 if the timer is not running.

Returns
The lap time

Definition at line 44 of file Timer.cpp.

◆ getTime()

double utils::Timer::getTime ( const std::clock_t & timer)
protected

Get the time spent until start.

Parameters
timerThe timer to get the time from
Returns
The time

Definition at line 70 of file Timer.cpp.

◆ isStarted()

bool utils::Timer::isStarted ( )

Return if the timer is started.

Returns
If the timer is started

Definition at line 24 of file Timer.cpp.

◆ pause()

void utils::Timer::pause ( )

Pause the timer.

Definition at line 26 of file Timer.cpp.

◆ resume()

void utils::Timer::resume ( )

Resume the timer. If it is paused, it adds a lap.

Definition at line 33 of file Timer.cpp.

◆ start()

void utils::Timer::start ( )

Start the timer.

Definition at line 17 of file Timer.cpp.

◆ stop()

double utils::Timer::stop ( )

Stop the timer and return the lap time.

Returns
The lap time

Definition at line 54 of file Timer.cpp.

Member Data Documentation

◆ m_isPaused

bool BIORBD_NAMESPACE::utils::Timer::m_isPaused
protected

If the timer is paused.

Definition at line 72 of file Timer.h.

◆ m_isStarted

bool BIORBD_NAMESPACE::utils::Timer::m_isStarted
protected

If the timer is started.

Definition at line 71 of file Timer.h.

◆ m_pauseTime

std::clock_t BIORBD_NAMESPACE::utils::Timer::m_pauseTime
protected

The pause time.

Definition at line 74 of file Timer.h.

◆ m_start

std::clock_t BIORBD_NAMESPACE::utils::Timer::m_start
protected

The start time.

Definition at line 73 of file Timer.h.

◆ m_totalPauseTime

double BIORBD_NAMESPACE::utils::Timer::m_totalPauseTime
protected

The total pause time.

Definition at line 75 of file Timer.h.


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