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

TSystemTimer.hh

解説を見る。
00001 // =====================================================================
00002 //  $Id: TSystemTimer.hh,v 1.2 2003/07/30 16:21:21 goiwai Exp $
00003 //  $Name: CLDAQ-1-08-01 $
00004 //
00005 //  $Log: TSystemTimer.hh,v $
00006 //  Revision 1.2  2003/07/30 16:21:21  goiwai
00007 //  ファイルにコミットログをつけることにしました.
00008 //
00009 // =====================================================================
00010 #ifndef __TSYSTEMTIMER_HH
00011 #define __TSYSTEMTIMER_HH
00012 
00013 #include "Tglobals.h"
00014 
00015 class TSystemTimer
00016 {
00017 
00018   private:
00019     enum { tUndefined = -1, tIdle, tReady, tRunning };
00020 
00021   private:
00022     Tint theStatus;
00023     Tstring theUnit;
00024     Tdouble theBeginOfRealTime;
00025     Tdouble theEndOfRealTime;
00026     Tdouble theBeginOfSystemTime;
00027     Tdouble theEndOfSystemTime;
00028     Tdouble theBeginOfUserTime;
00029     Tdouble theEndOfUserTime;
00030     Tdouble thePausedTime;
00031     Tdouble theRunningTime;
00032     Tdouble theIdlingTime;
00033     TdoubleList theRealLapTime;
00034     TdoubleList theSystemLapTime;
00035     TdoubleList theUserLapTime;
00036 
00037   public:
00038     TSystemTimer( const Tstring& theUnit = Tsec );
00039     TSystemTimer( const TSystemTimer& right );
00040     ~TSystemTimer();
00041 
00042   public:
00043     Tint GetStatus() const;
00044     Tdouble GetBeginOfRealTime() const;
00045     Tdouble GetEndOfRealTime() const;
00046     Tdouble GetBeginOfSystemTime() const;
00047     Tdouble GetEndOfSystemTime() const;
00048     Tdouble GetBeginOfUserTime() const;
00049     Tdouble GetEndOfUserTime() const;
00050     Tdouble GetPausedTime() const;
00051     Tdouble GetRunningTime() const;
00052     Tdouble GetIdlingTime() const;
00053     const TdoubleList& GetRealLapTime() const;
00054     const TdoubleList& GetSystemLapTime() const;
00055     const TdoubleList& GetUserLapTime() const;
00056     const Tstring& GetUnit() const;
00057     Tint GetNumberOfLaps() const;
00058     Tstring WhatTimeIsItNow();
00059     Tvoid SetUnit( const Tstring& unit );
00060 
00061   public:
00062     const TSystemTimer& operator=( const TSystemTimer& right );
00063     friend Tostream& operator<<( Tostream& tos, const TSystemTimer& right );
00064 
00065   public:
00066     Tvoid Start();
00067     Tvoid Pause();
00068     Tvoid Stop();
00069     Tvoid Lap();
00070     Tvoid Restart();
00071 
00072   private:
00073     Tvoid initialize();
00074     Tvoid clear();
00075     Tvoid start();
00076     Tvoid pause();
00077     Tvoid stop();
00078     Tvoid lap();
00079     Tvoid restart();
00080     Tvoid convertTimeScale( Tdouble factor );
00081 
00082   public:
00083     Tdouble GetRealElapsedTime();
00084     Tdouble GetSystemElapsedTime();
00085     Tdouble GetUserElapsedTime();
00086     Tdouble GetTotalRunningTime();
00087     Tdouble GetTotalIdlingTime();
00088 
00089 };
00090 
00091 inline Tint TSystemTimer::GetStatus() const
00092 {
00093   return( theStatus );
00094 }
00095 
00096 inline Tdouble TSystemTimer::GetBeginOfRealTime() const
00097 {
00098   return( theBeginOfRealTime );
00099 }
00100 
00101 inline Tdouble TSystemTimer::GetEndOfRealTime() const
00102 {
00103   return( theEndOfRealTime );
00104 }
00105 
00106 inline Tdouble TSystemTimer::GetBeginOfSystemTime() const
00107 {
00108   return( theBeginOfSystemTime );
00109 }
00110 
00111 inline Tdouble TSystemTimer::GetEndOfSystemTime() const
00112 {
00113   return( theEndOfSystemTime );
00114 }
00115 
00116 inline Tdouble TSystemTimer::GetBeginOfUserTime() const
00117 {
00118   return( theBeginOfUserTime );
00119 }
00120 
00121 inline Tdouble TSystemTimer::GetEndOfUserTime() const
00122 {
00123   return( theEndOfUserTime );
00124 }
00125 
00126 inline Tdouble TSystemTimer::GetPausedTime() const
00127 {
00128   return( thePausedTime );
00129 }
00130 
00131 inline Tdouble TSystemTimer::GetRunningTime() const
00132 {
00133   return( theRunningTime );
00134 }
00135 
00136 inline Tdouble TSystemTimer::GetIdlingTime() const
00137 {
00138   return( theIdlingTime );
00139 }
00140 
00141 inline const TdoubleList& TSystemTimer::GetRealLapTime() const
00142 {
00143   return( theRealLapTime );
00144 }
00145 
00146 inline const TdoubleList& TSystemTimer::GetSystemLapTime() const
00147 {
00148   return( theSystemLapTime );
00149 }
00150 
00151 inline const TdoubleList& TSystemTimer::GetUserLapTime() const
00152 {
00153   return( theUserLapTime );
00154 }
00155 
00156 inline const Tstring& TSystemTimer::GetUnit() const
00157 {
00158   return( theUnit );
00159 }
00160 
00161 inline Tint TSystemTimer::GetNumberOfLaps() const
00162 {
00163   return( (Tint)theRealLapTime.size() );
00164 }
00165 
00166 #endif

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