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