#ifndef TIMER_H #define TIMER_H #include //////////////////////////////////////////////////////////////////////////////// // Timer ///////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// class Timer { public: void Start() { gettimeofday(&m_start, NULL); } double StopWatch() { gettimeofday(&m_end, NULL); double timeSec = m_end.tv_sec - m_start.tv_sec + (m_end.tv_usec - m_start.tv_usec)*1E-6; return timeSec; } private: struct timeval m_start, m_end; }; #endif // TIMER_H