IT++
4.3.1
Toggle main menu visibility
itpp
base
timing.h
Go to the documentation of this file.
1
28
29
#ifndef TIMING_H
30
#define TIMING_H
31
32
#include <itpp/itexports.h>
33
34
namespace
itpp
35
{
36
40
45
class
ITPP_EXPORT
Timer
46
{
47
public
:
49
Timer
();
51
virtual
~Timer
() { }
53
void
start(
void
);
55
double
stop(
void
);
57
void
reset(
double
t = 0.0);
59
void
tic
(
void
);
61
double
toc
(
void
);
63
void
toc_print
(
void
);
65
double
get_time()
const
;
66
67
protected
:
69
virtual
double
get_current_time
()
const
= 0;
71
double
start_time
;
73
double
stop_time
;
75
double
elapsed_time
;
77
bool
running
;
78
};
79
104
class
ITPP_EXPORT
CPU_Timer
:
public
Timer
105
{
106
public
:
108
CPU_Timer
() { }
109
110
protected
:
112
double
get_current_time()
const
;
113
};
114
138
class
ITPP_EXPORT
Real_Timer
:
public
Timer
139
{
140
public
:
142
Real_Timer
() { }
143
144
protected
:
146
double
get_current_time()
const
;
147
};
148
153
ITPP_EXPORT
void
tic
();
154
159
ITPP_EXPORT
double
toc
();
160
165
ITPP_EXPORT
void
toc_print
();
166
175
ITPP_EXPORT
void
pause
(
double
t = -1);
176
177
}
// namespace itpp
178
179
#endif
// #ifndef TIMING_H
itpp::CPU_Timer::CPU_Timer
CPU_Timer()
Create a new timer. Sets the time to zero.
Definition
timing.h:108
itpp::Real_Timer::Real_Timer
Real_Timer()
Create a new timer. Sets the time to zero.
Definition
timing.h:142
itpp::Timer::start_time
double start_time
The start time of the timer.
Definition
timing.h:71
itpp::Timer::~Timer
virtual ~Timer()
Virtual destructor.
Definition
timing.h:51
itpp::Timer::running
bool running
A bool that indicates if the timer is running or not.
Definition
timing.h:77
itpp::Timer::elapsed_time
double elapsed_time
The ellapsed time from start to stop.
Definition
timing.h:75
itpp::Timer::Timer
Timer()
Create a new timer. Sets the time to zero.
Definition
timing.cpp:80
itpp::Timer::get_current_time
virtual double get_current_time() const =0
Vitrual function that returns teh current time.
itpp::Timer::stop_time
double stop_time
The stop time of the timer.
Definition
timing.h:73
itpp::pause
void pause(double t)
pause
Definition
timing.cpp:169
itpp::toc_print
void toc_print()
Prints the elapsed time since last tic().
Definition
timing.cpp:164
itpp::tic
void tic()
Reset and start timer.
Definition
timing.cpp:154
itpp::toc
double toc()
Returns the elapsed time since last tic().
Definition
timing.cpp:159
itpp
itpp namespace
Definition
itmex.h:37
Generated by
1.17.0