00001 // ===================================================================== 00024 // ===================================================================== 00025 #ifndef __TBENCHMARK_HH 00026 #define __TBENCHMARK_HH 00027 00028 #include "Tglobals.h" 00029 #include "TSystemTimer.hh" 00030 #include "TSystemClock.hh" 00031 00032 class TSystemTimer; 00033 class TSystemClock; 00034 00035 00055 class TBenchmark 00056 { 00057 00058 protected: 00059 TSystemTimer theSystemTimer; 00060 TSystemClock theSystemClock; 00061 Tstring theStartTime; 00062 Tstring theStopTime; 00063 00064 public: 00065 TBenchmark( const Tstring& unit = Tsec ); 00066 virtual ~TBenchmark(); 00067 00068 public: 00069 virtual Tvoid Start(); 00070 virtual Tvoid Pause(); 00071 virtual Tvoid Stop(); 00072 virtual Tvoid Lap(); 00073 virtual Tvoid Restart(); 00074 virtual Tvoid Continue(); 00075 virtual Tvoid PrintResult(); 00076 00077 public: 00078 friend Tostream& operator<<( Tostream& tos, const TBenchmark& right ); 00079 00080 public: 00081 const TSystemTimer& GetSystemTimer() const; 00082 const TSystemClock& GetSystemClock() const; 00083 TSystemTimer& GetSystemTimer(); 00084 TSystemClock& GetSystemClock(); 00085 const Tstring& GetStartTime() const; 00086 const Tstring& GetStopTime() const; 00087 Tvoid SetStartTime( const Tstring& time ); 00088 Tvoid SetStopTime( const Tstring& time ); 00089 00090 }; 00091 00092 inline const TSystemTimer& TBenchmark::GetSystemTimer() const 00093 { 00094 return theSystemTimer; 00095 } 00096 00097 inline const TSystemClock& TBenchmark::GetSystemClock() const 00098 { 00099 return theSystemClock; 00100 } 00101 00102 inline TSystemTimer& TBenchmark::GetSystemTimer() 00103 { 00104 return theSystemTimer; 00105 } 00106 00107 inline TSystemClock& TBenchmark::GetSystemClock() 00108 { 00109 return theSystemClock; 00110 } 00111 00112 inline const Tstring& TBenchmark::GetStartTime() const 00113 { 00114 return theStartTime; 00115 } 00116 00117 inline const Tstring& TBenchmark::GetStopTime() const 00118 { 00119 return theStopTime; 00120 } 00121 00122 inline Tvoid TBenchmark::SetStartTime( const Tstring& time ) 00123 { 00124 theStartTime = time; 00125 return; 00126 } 00127 00128 inline Tvoid TBenchmark::SetStopTime( const Tstring& time ) 00129 { 00130 theStopTime = time; 00131 return; 00132 } 00133 00134 #endif