00001 00030 #ifndef TIMING_H 00031 #define TIMING_H 00032 00033 00034 namespace itpp 00035 { 00036 00045 class Timer 00046 { 00047 public: 00049 Timer(); 00051 virtual ~Timer() { } 00053 void start(void); 00055 double stop(void); 00057 void reset(double t = 0.0); 00059 void tic(void); 00061 double toc(void); 00063 void toc_print(void); 00065 double get_time() const; 00066 00067 protected: 00069 virtual double get_current_time() const = 0; 00071 double start_time; 00073 double stop_time; 00075 double elapsed_time; 00077 bool running; 00078 }; 00079 00104 class CPU_Timer : public Timer 00105 { 00106 public: 00108 CPU_Timer() { } 00109 00110 protected: 00112 double get_current_time() const; 00113 }; 00114 00138 class Real_Timer : public Timer 00139 { 00140 public: 00142 Real_Timer() { } 00143 00144 protected: 00146 double get_current_time() const; 00147 }; 00148 00153 void tic(); 00154 00159 double toc(); 00160 00165 void toc_print(); 00166 00175 void pause(double t = -1); 00176 00177 } // namespace itpp 00178 00179 #endif // #ifndef TIMING_H
Generated on Sun Jul 26 08:54:54 2009 for IT++ by Doxygen 1.5.9