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