Fortuna PRNG C++ Source Code

Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CitadelSoftwareInc::Timer Class Reference

#include <Timer.h>

List of all members.

Public Member Functions

 Timer ()
 ~Timer ()
void Start ()
void Stop ()
void Curr ()
int AddElapsedTime (vecuc &vData)
int AddElapsedTimeDifference (vecuc &vData)
unsigned int GetLowByteTimeDiff ()

Public Attributes

bool m_bTimer
LARGE_INTEGER m_frequency
LARGE_INTEGER m_startTime
LARGE_INTEGER m_stopTime
LARGE_INTEGER m_currTime

Constructor & Destructor Documentation

CitadelSoftwareInc::Timer::Timer  ) 
 

Definition at line 18 of file Timer.cpp.

References m_bTimer, m_currTime, m_frequency, m_startTime, and m_stopTime.

00019 {
00020         m_bTimer = QueryPerformanceFrequency(&m_frequency) ? true : false;
00021 
00022         if (!m_bTimer)
00023         {
00024                 m_frequency.HighPart = 0;
00025                 m_frequency.LowPart = 1000;             // just use GetTickCount()
00026         }
00027 
00028         m_startTime.QuadPart = 0;
00029         m_stopTime.QuadPart = 0;
00030         m_currTime.QuadPart = 0;
00031 }

CitadelSoftwareInc::Timer::~Timer  ) 
 

Definition at line 34 of file Timer.cpp.

00035 {
00036 }

Member Function Documentation

int CitadelSoftwareInc::Timer::AddElapsedTime vecuc vData  ) 
 

Definition at line 65 of file Timer.cpp.

References m_startTime, m_stopTime, and CitadelSoftwareInc::vecuc.

Referenced by CitadelSoftwareInc::AddProcessData(), CitadelSoftwareInc::SourcePing::GetChaoticData(), CitadelSoftwareInc::GetMachineSignature(), and CitadelSoftwareInc::Source::ThreadHandlerProc().

00066 {
00067         int count=0;
00068         const unsigned char* pStart = (const unsigned char*)&m_startTime;
00069         const unsigned char* pStop = (const unsigned char*)&m_stopTime;
00070 
00071         unsigned char uc1=0, uc2=0;
00072         const int iSize = sizeof(LARGE_INTEGER);
00073         for (int i=0; i<iSize; ++i)
00074         {
00075                 uc1 = pStart[i];
00076                 uc2 = pStop[i];
00077 
00078                 if (uc1 && uc2)
00079                 {
00080                         if( uc1 == uc2 )
00081                         {
00082                                 vData.push_back(uc1);
00083                                 count += 1;
00084                         }
00085                         else
00086                         {
00087                                 vData.push_back(uc1);
00088                                 vData.push_back(uc2);
00089                                 count += 2;
00090                         }
00091                 }
00092 
00093         }
00094         return count;
00095 }

int CitadelSoftwareInc::Timer::AddElapsedTimeDifference vecuc vData  ) 
 

Definition at line 98 of file Timer.cpp.

References m_startTime, m_stopTime, and CitadelSoftwareInc::vecuc.

Referenced by CitadelSoftwareInc::SourcePing::GetChaoticData(), and CitadelSoftwareInc::GetMachineSignature().

00099 {
00100         int count=0;
00101         const unsigned char* pStart = (const unsigned char*)&m_startTime;
00102         const unsigned char* pStop = (const unsigned char*)&m_stopTime;
00103 
00104         unsigned char uc1=0, uc2=0;
00105         const int iSize = sizeof(LARGE_INTEGER);
00106         for (int i=0; i<iSize; ++i)
00107         {
00108                 uc1 = pStart[i];
00109                 uc2 = pStop[i];
00110 
00111                 if (uc1 && uc2)
00112                 {
00113                         if( uc1 == uc2 )
00114                         {
00115                                 break;
00116                         }
00117                         else
00118                         {
00119                                 vData.push_back(uc1);
00120                                 vData.push_back(uc2);
00121                                 count += 1;
00122                         }
00123                 }
00124 
00125         }
00126         return count;
00127 }

void CitadelSoftwareInc::Timer::Curr  ) 
 

Definition at line 56 of file Timer.cpp.

References m_bTimer, and m_currTime.

Referenced by CitadelSoftwareInc::InitRand(), CitadelSoftwareInc::Source::ThreadHandlerProc(), and CitadelSoftwareInc::Pool::ThreadHandlerProc().

00057 {
00058         if (m_bTimer)
00059                 QueryPerformanceCounter(&m_currTime);
00060         else
00061                 m_currTime.LowPart = GetTickCount();
00062 }

unsigned int CitadelSoftwareInc::Timer::GetLowByteTimeDiff  )  [inline]
 

Definition at line 26 of file Timer.h.

References m_startTime, and m_stopTime.

Referenced by CitadelSoftwareInc::SourcePing::GetChaoticData().

00026 { return (unsigned int)((m_stopTime.LowPart-m_startTime.LowPart) & 0xff); }

void CitadelSoftwareInc::Timer::Start  ) 
 

Definition at line 38 of file Timer.cpp.

References m_bTimer, m_currTime, m_startTime, and m_stopTime.

Referenced by CitadelSoftwareInc::AddProcessData(), CitadelSoftwareInc::SourcePing::GetChaoticData(), CitadelSoftwareInc::GetMachineSignature(), and CitadelSoftwareInc::Source::ThreadHandlerProc().

00039 {
00040         m_stopTime.QuadPart = 0;
00041         m_currTime.QuadPart = 0;
00042         if (m_bTimer)
00043                 QueryPerformanceCounter(&m_startTime);
00044         else
00045                 m_startTime.LowPart = GetTickCount();
00046 }

void CitadelSoftwareInc::Timer::Stop  ) 
 

Definition at line 48 of file Timer.cpp.

References m_bTimer, and m_stopTime.

Referenced by CitadelSoftwareInc::AddProcessData(), CitadelSoftwareInc::SourcePing::GetChaoticData(), CitadelSoftwareInc::GetMachineSignature(), and CitadelSoftwareInc::Source::ThreadHandlerProc().

00049 {
00050         if (m_bTimer)
00051                 QueryPerformanceCounter(&m_stopTime);
00052         else
00053                 m_stopTime.LowPart = GetTickCount();
00054 }

Member Data Documentation

bool CitadelSoftwareInc::Timer::m_bTimer
 

Definition at line 29 of file Timer.h.

Referenced by Curr(), Start(), Stop(), and Timer().

LARGE_INTEGER CitadelSoftwareInc::Timer::m_currTime
 

Definition at line 33 of file Timer.h.

Referenced by Curr(), CitadelSoftwareInc::InitRand(), Start(), CitadelSoftwareInc::Source::ThreadHandlerProc(), CitadelSoftwareInc::Pool::ThreadHandlerProc(), and Timer().

LARGE_INTEGER CitadelSoftwareInc::Timer::m_frequency
 

Definition at line 30 of file Timer.h.

Referenced by Timer().

LARGE_INTEGER CitadelSoftwareInc::Timer::m_startTime
 

Definition at line 31 of file Timer.h.

Referenced by AddElapsedTime(), AddElapsedTimeDifference(), GetLowByteTimeDiff(), Start(), and Timer().

LARGE_INTEGER CitadelSoftwareInc::Timer::m_stopTime
 

Definition at line 32 of file Timer.h.

Referenced by AddElapsedTime(), AddElapsedTimeDifference(), GetLowByteTimeDiff(), Start(), Stop(), and Timer().

The documentation for this class was generated from the following files:
bulletTimer.h
bulletTimer.cpp

Generated on Sat Feb 28 17:24:47 2004 for Fortuna by doxygen 1.3.5