timing.h
Go to the documentation of this file.
#ifndef TIMING_H
#define TIMING_H
#include <itpp/itexports.h>
namespace itpp
{
class ITPP_EXPORT Timer
{
public:
Timer();
virtual ~Timer() { }
void start(void);
double stop(void);
void reset(double t = 0.0);
void tic(void);
double toc(void);
void toc_print(void);
double get_time() const;
protected:
virtual double get_current_time() const = 0;
double start_time;
double stop_time;
double elapsed_time;
bool running;
};
class ITPP_EXPORT CPU_Timer : public Timer
{
public:
CPU_Timer() { }
protected:
double get_current_time() const;
};
class ITPP_EXPORT Real_Timer : public Timer
{
public:
Real_Timer() { }
protected:
double get_current_time() const;
};
ITPP_EXPORT void tic();
ITPP_EXPORT double toc();
ITPP_EXPORT void toc_print();
ITPP_EXPORT void pause(double t = -1);
} // namespace itpp
#endif // #ifndef TIMING_H
itpp::Array
General array class.
Definition array.h:105
itpp::CPU_Timer
A CPU time timer class.
Definition timing.h:105
itpp::CPU_Timer::CPU_Timer
CPU_Timer()
Create a new timer. Sets the time to zero.
Definition timing.h:108
itpp::Real_Timer
A real time timer class.
Definition timing.h:139
itpp::Real_Timer::Real_Timer
Real_Timer()
Create a new timer. Sets the time to zero.
Definition timing.h:142
itpp::Timer
A virtual base class for timers.
Definition timing.h:46
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::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 on Mon Jun 10 2024 11:49:19 for IT++ by Doxygen 1.9.8