timer.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __GECODE_EXAMPLES_TIMER_HH__
00026 #define __GECODE_EXAMPLES_TIMER_HH__
00027
00028 #include <ctime>
00029 #include <cmath>
00030
00031 #include "gecode/config.icc"
00032
00033
00034
00035
00036
00037
00039 class Timer {
00040 private:
00041 clock_t t0;
00042 public:
00043 void start(void);
00044 double stop(void);
00045 };
00046
00047 forceinline void
00048 Timer::start(void) {
00049 t0 = clock();
00050 }
00051 forceinline double
00052 Timer::stop(void) {
00053 return (static_cast<double>(clock()-t0) / CLOCKS_PER_SEC) * 1000.0;
00054 }
00055
00056
00061 double
00062 am(double t[], int n);
00067 double
00068 dev(double t[], int n);
00069
00070 #endif
00071
00072