Biorbd
Release_1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Timer.h
1
#ifndef BIORBD_UTILS_TIMER_H
2
#define BIORBD_UTILS_TIMER_H
3
4
#include "biorbdConfig.h"
5
6
#include <ctime>
7
#include <memory>
8
9
namespace
BIORBD_NAMESPACE {
10
namespace
utils {
11
15
class
BIORBD_API
Timer
{
16
public
:
21
Timer
(
bool
startNow =
false
);
22
26
void
start
();
27
32
bool
isStarted
();
33
37
void
pause
();
38
42
void
resume
();
43
49
double
getLap
();
50
55
double
stop
();
56
57
protected
:
62
void
addPauseTime
();
63
69
double
getTime
(
const
std::clock_t& timer);
70
71
bool
m_isStarted
;
72
bool
m_isPaused
;
73
std::clock_t
m_start
;
74
std::clock_t
m_pauseTime
;
75
double
m_totalPauseTime
;
76
};
77
78
}
// namespace utils
79
}
// namespace BIORBD_NAMESPACE
80
81
#endif
// BIORBD_UTILS_TIMER_H
BIORBD_NAMESPACE::utils::Timer::getTime
double getTime(const std::clock_t &timer)
Get the time spent until start.
Definition
Timer.cpp:70
BIORBD_NAMESPACE::utils::Timer::isStarted
bool isStarted()
Return if the timer is started.
Definition
Timer.cpp:24
BIORBD_NAMESPACE::utils::Timer::Timer
Timer(bool startNow=false)
Construct timer.
Definition
Timer.cpp:6
BIORBD_NAMESPACE::utils::Timer::m_pauseTime
std::clock_t m_pauseTime
The pause time.
Definition
Timer.h:74
BIORBD_NAMESPACE::utils::Timer::m_isPaused
bool m_isPaused
If the timer is paused.
Definition
Timer.h:72
BIORBD_NAMESPACE::utils::Timer::m_isStarted
bool m_isStarted
If the timer is started.
Definition
Timer.h:71
BIORBD_NAMESPACE::utils::Timer::start
void start()
Start the timer.
Definition
Timer.cpp:17
BIORBD_NAMESPACE::utils::Timer::resume
void resume()
Resume the timer. If it is paused, it adds a lap.
Definition
Timer.cpp:33
BIORBD_NAMESPACE::utils::Timer::getLap
double getLap()
Get the lap time of a running timer. Return 0 if the timer is not running.
Definition
Timer.cpp:44
BIORBD_NAMESPACE::utils::Timer::addPauseTime
void addPauseTime()
Add a pause to the timer time (total time being execution time - pause time).
Definition
Timer.cpp:63
BIORBD_NAMESPACE::utils::Timer::m_start
std::clock_t m_start
The start time.
Definition
Timer.h:73
BIORBD_NAMESPACE::utils::Timer::m_totalPauseTime
double m_totalPauseTime
The total pause time.
Definition
Timer.h:75
BIORBD_NAMESPACE::utils::Timer::stop
double stop()
Stop the timer and return the lap time.
Definition
Timer.cpp:54
BIORBD_NAMESPACE::utils::Timer::pause
void pause()
Pause the timer.
Definition
Timer.cpp:26
include
Utils
Timer.h
Generated by
1.18.0