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::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::toc
double toc()
Returns the elapsed time since last tic()
Definition: timing.cpp:159
itpp::Timer::elapsed_time
double elapsed_time
The ellapsed time from start to stop.
Definition: timing.h:75
itpp::Timer::running
bool running
A bool that indicates if the timer is running or not.
Definition: timing.h:77
itpp::Real_Timer::Real_Timer
Real_Timer()
Create a new timer. Sets the time to zero.
Definition: timing.h:142
itpp
itpp namespace
Definition: itmex.h:36
itpp::Real_Timer
A real time timer class.
Definition: timing.h:138
itpp::CPU_Timer
A CPU time timer class.
Definition: timing.h:104
itpp::toc_print
void toc_print()
Prints the elapsed time since last tic()
Definition: timing.cpp:164
itpp::Timer
A virtual base class for timers.
Definition: timing.h:45
itpp::pause
void pause(double t)
pause
Definition: timing.cpp:169
itpp::tic
void tic()
Reset and start timer.
Definition: timing.cpp:154
itpp::Timer::stop_time
double stop_time
The stop time of the timer.
Definition: timing.h:73
itpp::CPU_Timer::CPU_Timer
CPU_Timer()
Create a new timer. Sets the time to zero.
Definition: timing.h:108

Generated on Mon Mar 23 2020 06:18:03 for IT++ by Doxygen 1.8.17