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

TSystemTimer.hh

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

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