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