00001
00002
00003
00004
00005
00006
00007
00008
00009
00014
00015 #ifndef OCTANE_TIMER_HPP_INCLUDED
00016 #define OCTANE_TIMER_HPP_INCLUDED
00017
00018 #include <ctime>
00019
00020
00021
00022
00023 using namespace std;
00024
00032 class OctaneTimer {
00033
00034 public:
00036 OctaneTimer() : begin(clock()), elapsed(0.0) { ; }
00037
00039 void start() { begin = clock(); }
00040
00044 float stop()
00045 {
00046 clock_t end = clock();
00047 elapsed = (float)(end - begin)/(float)CLOCKS_PER_SEC;
00048 return elapsed;
00049 }
00050
00054 float get_elapsed() const { return elapsed; }
00055
00056 private:
00057 clock_t begin;
00058 float elapsed;
00059 };
00060
00061 #endif // OCTANE_TIMER_HPP_INCLUDED