00001 #ifndef __CPrecisionTimer__ 00002 #define __CPrecisionTimer__ 00003 00004 #include "../Basics/CCountedObject.hpp" 00005 00006 namespace Exponent 00007 { 00008 namespace Testing 00009 { 00027 class CPrecisionTimer 00028 { 00029 public: 00030 00031 // =========================================================================== 00035 CPrecisionTimer(); 00036 00040 virtual ~CPrecisionTimer(); 00041 00045 void startTimer(); 00046 00051 double getProcessorTime(); 00052 00058 double getCPUUsage(const long numberOfSamples); 00059 00064 void setSampleRate(const double sampleRate) { m_sampleRate = sampleRate; } 00065 00069 static void initialise(); 00070 00071 // =========================================================================== 00072 00073 protected: 00074 00075 // =========================================================================== 00076 00077 static bool CPRECISION_TIMER_INITIALISED; 00078 static double CPRECISION_TIMER_INV_FREQUENCY; 00080 // =========================================================================== 00081 00082 uint64 m_counter; 00083 double m_sampleRate; 00085 // =========================================================================== 00086 00087 }; 00088 } 00089 } 00090 #endif // End of CPrecisionTimer.hpp