00001 // ===================================================================== 00002 // $Id: TBenchmark.hh,v 1.1.1.1 2003/06/27 02:56:42 goiwai Exp $ 00003 // $Name: CLDAQ-1-06-02 $ 00004 // ===================================================================== 00005 #ifndef __TBENCHMARK_HH 00006 #define __TBENCHMARK_HH 00007 00008 #include "Tglobals.h" 00009 #include "TSystemTimer.hh" 00010 #include "TSystemClock.hh" 00011 00012 class TSystemTimer; 00013 class TSystemClock; 00014 00015 class TBenchmark 00016 { 00017 00018 protected: 00019 TSystemTimer theSystemTimer; 00020 TSystemClock theSystemClock; 00021 Tstring theStartTime; 00022 Tstring theStopTime; 00023 00024 public: 00025 TBenchmark( const Tstring& unit = Tsec ); 00026 virtual ~TBenchmark(); 00027 00028 public: 00029 virtual Tvoid Start(); 00030 virtual Tvoid Pause(); 00031 virtual Tvoid Stop(); 00032 virtual Tvoid Lap(); 00033 virtual Tvoid Restart(); 00034 virtual Tvoid Continue(); 00035 virtual Tvoid PrintResult(); 00036 00037 public: 00038 friend Tostream& operator<<( Tostream& tos, const TBenchmark& right ); 00039 00040 public: 00041 const TSystemTimer& GetSystemTimer() const; 00042 const TSystemClock& GetSystemClock() const; 00043 const Tstring& GetStartTime() const; 00044 const Tstring& GetStopTime() const; 00045 Tvoid SetStartTime( const Tstring& time ); 00046 Tvoid SetStopTime( const Tstring& time ); 00047 00048 }; 00049 00050 inline const TSystemTimer& TBenchmark::GetSystemTimer() const 00051 { 00052 return( theSystemTimer ); 00053 } 00054 00055 inline const TSystemClock& TBenchmark::GetSystemClock() const 00056 { 00057 return( theSystemClock ); 00058 } 00059 00060 inline const Tstring& TBenchmark::GetStartTime() const 00061 { 00062 return( theStartTime ); 00063 } 00064 00065 inline const Tstring& TBenchmark::GetStopTime() const 00066 { 00067 return( theStopTime ); 00068 } 00069 00070 inline Tvoid TBenchmark::SetStartTime( const Tstring& time ) 00071 { 00072 theStartTime = time; 00073 return; 00074 } 00075 00076 inline Tvoid TBenchmark::SetStopTime( const Tstring& time ) 00077 { 00078 theStopTime = time; 00079 return; 00080 } 00081 00082 #endif