00001 00033 #ifndef TIMING_H 00034 #define TIMING_H 00035 00036 00037 namespace itpp { 00038 00047 class Timer { 00048 public: 00050 Timer(); 00052 virtual ~Timer() { } 00054 void start(void); 00056 double stop(void); 00058 void reset(double t=0.0); 00060 void tic(void); 00062 double toc(void); 00064 void toc_print(void); 00066 double get_time() const; 00067 00068 protected: 00070 virtual double get_current_time() const = 0; 00072 double start_time; 00074 double stop_time; 00076 double elapsed_time; 00078 bool running; 00079 }; 00080 00105 class CPU_Timer : public Timer { 00106 public: 00108 CPU_Timer() { } 00109 00110 protected: 00112 double get_current_time() const; 00113 }; 00114 00138 class Real_Timer : public Timer { 00139 public: 00141 Real_Timer() { } 00142 00143 protected: 00145 double get_current_time() const; 00146 }; 00147 00152 void tic(); 00153 00158 double toc(); 00159 00164 void toc_print(); 00165 00174 void pause(double t=-1); 00175 00176 } // namespace itpp 00177 00178 #endif // #ifndef TIMING_H
Generated on Sat Aug 25 23:40:03 2007 for IT++ by Doxygen 1.5.2