メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TSystemTimer.hh

解説を見る。
00001 // =====================================================================
00024 // =====================================================================
00025 #ifndef CLDAQ__TSYSTEMTIMER_HH
00026 #define CLDAQ__TSYSTEMTIMER_HH
00027 
00028 #include "Tglobals.h"
00029 
00030 
00050 class TSystemTimer
00051 {
00052 
00053   private:
00054     enum { tUndefined = -1, tIdle, tReady, tRunning };
00055 
00056   private:
00057     Tint theStatus;
00058     Tstring theUnit;
00059     Tdouble theBeginOfRealTime;
00060     Tdouble theEndOfRealTime;
00061     Tdouble theBeginOfSystemTime;
00062     Tdouble theEndOfSystemTime;
00063     Tdouble theBeginOfUserTime;
00064     Tdouble theEndOfUserTime;
00065     Tdouble thePausedTime;
00066     Tdouble theRunningTime;
00067     Tdouble theIdlingTime;
00068     TdoubleList theRealLapTime;
00069     TdoubleList theSystemLapTime;
00070     TdoubleList theUserLapTime;
00071 
00072   public:
00073     TSystemTimer( const Tstring& theUnit = Tsec );
00074     TSystemTimer( const TSystemTimer& right );
00075     ~TSystemTimer();
00076 
00077   public:
00078     Tint GetStatus() const;
00079     Tdouble GetBeginOfRealTime() const;
00080     Tdouble GetEndOfRealTime() const;
00081     Tdouble GetBeginOfSystemTime() const;
00082     Tdouble GetEndOfSystemTime() const;
00083     Tdouble GetBeginOfUserTime() const;
00084     Tdouble GetEndOfUserTime() const;
00085     Tdouble GetPausedTime() const;
00086     Tdouble GetRunningTime() const;
00087     Tdouble GetIdlingTime() const;
00088     const TdoubleList& GetRealLapTime() const;
00089     const TdoubleList& GetSystemLapTime() const;
00090     const TdoubleList& GetUserLapTime() const;
00091     const Tstring& GetUnit() const;
00092     Tint GetNumberOfLaps() const;
00093     Tstring WhatTimeIsItNow();
00094     Tvoid SetUnit( const Tstring& unit );
00095 
00096   public:
00097     const TSystemTimer& operator=( const TSystemTimer& right );
00098     friend Tostream& operator<<( Tostream& tos, const TSystemTimer& right );
00099 
00100   public:
00101     Tvoid Start();
00102     Tvoid Pause();
00103     Tvoid Stop();
00104     Tvoid Lap();
00105     Tvoid Restart();
00106 
00107   private:
00108     Tvoid initialize();
00109     Tvoid clear();
00110     Tvoid start();
00111     Tvoid pause();
00112     Tvoid stop();
00113     Tvoid lap();
00114     Tvoid restart();
00115     Tvoid convertTimeScale( Tdouble factor );
00116 
00117   public:
00118     Tdouble GetRealElapsedTime();
00119     Tdouble GetSystemElapsedTime();
00120     Tdouble GetUserElapsedTime();
00121     Tdouble GetTotalRunningTime();
00122     Tdouble GetTotalIdlingTime();
00123 
00124 };
00125 
00126 inline Tint TSystemTimer::GetStatus() const
00127 {
00128   return theStatus;
00129 }
00130 
00131 inline Tdouble TSystemTimer::GetBeginOfRealTime() const
00132 {
00133   return theBeginOfRealTime;
00134 }
00135 
00136 inline Tdouble TSystemTimer::GetEndOfRealTime() const
00137 {
00138   return theEndOfRealTime;
00139 }
00140 
00141 inline Tdouble TSystemTimer::GetBeginOfSystemTime() const
00142 {
00143   return theBeginOfSystemTime;
00144 }
00145 
00146 inline Tdouble TSystemTimer::GetEndOfSystemTime() const
00147 {
00148   return theEndOfSystemTime;
00149 }
00150 
00151 inline Tdouble TSystemTimer::GetBeginOfUserTime() const
00152 {
00153   return theBeginOfUserTime;
00154 }
00155 
00156 inline Tdouble TSystemTimer::GetEndOfUserTime() const
00157 {
00158   return theEndOfUserTime;
00159 }
00160 
00161 inline Tdouble TSystemTimer::GetPausedTime() const
00162 {
00163   return thePausedTime;
00164 }
00165 
00166 inline Tdouble TSystemTimer::GetRunningTime() const
00167 {
00168   return theRunningTime;
00169 }
00170 
00171 inline Tdouble TSystemTimer::GetIdlingTime() const
00172 {
00173   return theIdlingTime;
00174 }
00175 
00176 inline const TdoubleList& TSystemTimer::GetRealLapTime() const
00177 {
00178   return theRealLapTime;
00179 }
00180 
00181 inline const TdoubleList& TSystemTimer::GetSystemLapTime() const
00182 {
00183   return theSystemLapTime;
00184 }
00185 
00186 inline const TdoubleList& TSystemTimer::GetUserLapTime() const
00187 {
00188   return theUserLapTime;
00189 }
00190 
00191 inline const Tstring& TSystemTimer::GetUnit() const
00192 {
00193   return theUnit;
00194 }
00195 
00196 inline Tint TSystemTimer::GetNumberOfLaps() const
00197 {
00198   return (Tint)theRealLapTime.size();
00199 }
00200 
00201 #endif

CLDAQ - a Class Library for Data AcQuisition (Version 1.12.0)
Go IWAI <goiwai@users.sourceforge.jp>