SG_TRC::CL_TimerVal Class Reference

Class to manipulate system time. More...

#include <timer.h>

Inherits SG_TRC::CL_Virtual_Record.

List of all members.

Public Member Functions

 CL_TimerVal (void)
 Default Constructor.
 CL_TimerVal (const CL_TimerVal &Time2)
 Copy Constructor.
 CL_TimerVal (const CL_Virtual_Record &_Rec2)
 CL_TimerVal (const ST_Timeval &_Timeval)
 CL_TimerVal (const long T)
 Other Constructor.
 ~CL_TimerVal (void)
void Clear ()
 Destructor Clear the time value.
void SetToMax ()
 Clear the time value.
void SetToMin ()
_SG_TRC_INLINE CL_TimerValoperator= (const long T)
 operator =.
_SG_TRC_INLINE CL_TimerValoperator= (const CL_TimerVal &Time2)
 operator =.
_SG_TRC_INLINE CL_TimerValoperator= (const ST_Timeval &_Timeval)
_SG_TRC_INLINE bool operator!= (const CL_TimerVal &Time2)
 operator !=.
_SG_TRC_INLINE bool operator== (const CL_TimerVal &Time2)
 operator ==.
_SG_TRC_INLINE bool operator< (const CL_TimerVal &Time2)
 operator < for comparing times.
_SG_TRC_INLINE bool operator> (const CL_TimerVal &Time2)
 operator > for comparing times.
_SG_TRC_INLINE CL_TimerValoperator+= (const CL_TimerVal &Time2)
 operator += for adding times.
_SG_TRC_INLINE CL_TimerValoperator-= (const CL_TimerVal &Time2)
 operator -= for substracting times.
_SG_TRC_INLINE CL_TimerValoperator/= (const long T)
 operator /= for dividing times.
_SG_TRC_INLINE CL_TimerValoperator *= (const long T)
 operator *= for multiplying times.
_SG_TRC_INLINE CL_TimerVal operator+ (const CL_TimerVal &Time2) const
 operator +.
_SG_TRC_INLINE CL_TimerVal operator- (const CL_TimerVal &Time2) const
 operator -.
_SG_TRC_INLINE CL_TimerVal operator/ (const long T) const
 operator /.
_SG_TRC_INLINE CL_TimerVal operator * (const long T) const
 operator *.
_SG_TRC_INLINE void AddTimeUs (const unsigned int _time)
_SG_TRC_INLINE void AddTimeMs (const unsigned int _time)
_SG_TRC_INLINE long GetValue (void)
 Return the time value stored in Time as a long.
_SG_TRC_INLINE std::string GetStr (bool _Approxmimate=true) const
_SG_TRC_INLINE void Print ()
 Print the time value as "\n%ds %d µs".
_SG_TRC_INLINE void Run (CL_TimerVal *StopTime=NULL)
TiXmlElement * XMLLoad (TiXmlElement *_XML_ROOT, std::string _Name="")
 This fonction read the given XML stream looking for the _Name tag, then reads values.
TiXmlElement * XMLSave (TiXmlElement *_XML_ROOT, std::string _Name="")
 This fonction save CL_TimerVal object into a XML tag called _Name and inserted ibnto the XML stream _XML_ROOT.

Public Attributes

long tv_sec
 Time in seconds.
long tv_usec
 Time in microseconds.
bool succes
int returnValue


Detailed Description

Class to manipulate system time.

Author:
Yannick ALLUSSE
Version:
2.0
Date:
2006 Manipulate system time, compatible with MS Windows XP and 2000, UNIX like and MAC OS It is base on timeval struct from winsock.h
                struct timeval {
                                long    tv_sec;         /* seconds 
                                long    tv_usec;        /* and microseconds 
                };
Note:
see http://haypo.developpez.com/article/frequence_cpu/ to check if it is more accurate..???

Definition at line 126 of file timer.h.


Constructor & Destructor Documentation

SG_TRC::CL_TimerVal::CL_TimerVal void   ) 
 

Default Constructor.

Definition at line 27 of file timer.cpp.

References Clear().

SG_TRC::CL_TimerVal::CL_TimerVal const CL_TimerVal Time2  ) 
 

Copy Constructor.

Definition at line 32 of file timer.cpp.

References Clear().

SG_TRC::CL_TimerVal::CL_TimerVal const CL_Virtual_Record _Rec2  ) 
 

Definition at line 38 of file timer.cpp.

References Clear().

SG_TRC::CL_TimerVal::CL_TimerVal const ST_Timeval _Timeval  ) 
 

Definition at line 50 of file timer.cpp.

SG_TRC::CL_TimerVal::CL_TimerVal const long  T  ) 
 

Other Constructor.

Definition at line 44 of file timer.cpp.

References Clear().

SG_TRC::CL_TimerVal::~CL_TimerVal void   )  [inline]
 

Definition at line 139 of file timer.h.


Member Function Documentation

_SG_TRC_INLINE void SG_TRC::CL_TimerVal::AddTimeMs const unsigned int  _time  ) 
 

_SG_TRC_INLINE void SG_TRC::CL_TimerVal::AddTimeUs const unsigned int  _time  ) 
 

void SG_TRC::CL_TimerVal::Clear  )  [virtual]
 

Destructor Clear the time value.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 53 of file timer.cpp.

References returnValue, SetToMin(), and succes.

Referenced by CL_TimerVal(), and XMLLoad().

std::string SG_TRC::CL_TimerVal::GetStr bool  _Approxmimate = true  )  const
 

Definition at line 217 of file timer.cpp.

References tv_sec, and tv_usec.

long SG_TRC::CL_TimerVal::GetValue void   )  [virtual]
 

Return the time value stored in Time as a long.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 212 of file timer.cpp.

Referenced by operator *=(), operator/=(), and SG_TRC::CL_FUNCT_TRC< TracerType >::SaveToSVGFile().

CL_TimerVal SG_TRC::CL_TimerVal::operator * const long  T  )  const
 

operator *.

Definition at line 181 of file timer.cpp.

CL_TimerVal & SG_TRC::CL_TimerVal::operator *= const long  T  )  [virtual]
 

operator *= for multiplying times.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 162 of file timer.cpp.

References GetValue().

bool SG_TRC::CL_TimerVal::operator!= const CL_TimerVal Time2  ) 
 

operator !=.

Definition at line 111 of file timer.cpp.

References tv_sec, and tv_usec.

CL_TimerVal SG_TRC::CL_TimerVal::operator+ const CL_TimerVal Time2  )  const
 

operator +.

Definition at line 169 of file timer.cpp.

CL_TimerVal & SG_TRC::CL_TimerVal::operator+= const CL_TimerVal Time2  ) 
 

operator += for adding times.

Definition at line 125 of file timer.cpp.

References tv_sec, and tv_usec.

CL_TimerVal SG_TRC::CL_TimerVal::operator- const CL_TimerVal Time2  )  const
 

operator -.

Definition at line 175 of file timer.cpp.

CL_TimerVal & SG_TRC::CL_TimerVal::operator-= const CL_TimerVal Time2  ) 
 

operator -= for substracting times.

Definition at line 140 of file timer.cpp.

References tv_sec, and tv_usec.

CL_TimerVal SG_TRC::CL_TimerVal::operator/ const long  T  )  const
 

operator /.

Definition at line 187 of file timer.cpp.

CL_TimerVal & SG_TRC::CL_TimerVal::operator/= const long  T  )  [virtual]
 

operator /= for dividing times.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 155 of file timer.cpp.

References GetValue().

bool SG_TRC::CL_TimerVal::operator< const CL_TimerVal Time2  ) 
 

operator < for comparing times.

Definition at line 194 of file timer.cpp.

CL_TimerVal & SG_TRC::CL_TimerVal::operator= const ST_Timeval _Timeval  ) 
 

Definition at line 90 of file timer.cpp.

References tv_sec, and tv_usec.

CL_TimerVal & SG_TRC::CL_TimerVal::operator= const CL_TimerVal Time2  ) 
 

operator =.

Definition at line 70 of file timer.cpp.

References tv_sec, and tv_usec.

CL_TimerVal & SG_TRC::CL_TimerVal::operator= const long  T  )  [virtual]
 

operator =.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 83 of file timer.cpp.

References tv_sec, and tv_usec.

bool SG_TRC::CL_TimerVal::operator== const CL_TimerVal Time2  ) 
 

operator ==.

Definition at line 97 of file timer.cpp.

References tv_sec, and tv_usec.

bool SG_TRC::CL_TimerVal::operator> const CL_TimerVal Time2  ) 
 

operator > for comparing times.

Definition at line 199 of file timer.cpp.

References tv_sec, and tv_usec.

void SG_TRC::CL_TimerVal::Print  )  [virtual]
 

Print the time value as "\n%ds %d µs".

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 244 of file timer.cpp.

References tv_sec, and tv_usec.

void SG_TRC::CL_TimerVal::Run CL_TimerVal StopTime = NULL  ) 
 

Definition at line 250 of file timer.cpp.

References SG_TRC::Ygettimeofday().

Referenced by SG_TRC::StopRecording().

void SG_TRC::CL_TimerVal::SetToMax  )  [virtual]
 

Clear the time value.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 59 of file timer.cpp.

References tv_sec, and tv_usec.

void SG_TRC::CL_TimerVal::SetToMin  )  [virtual]
 

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 64 of file timer.cpp.

References tv_sec, and tv_usec.

Referenced by Clear().

TiXmlElement * SG_TRC::CL_TimerVal::XMLLoad TiXmlElement *  _XML_ROOT,
std::string  _Name = ""
[virtual]
 

This fonction read the given XML stream looking for the _Name tag, then reads values.

Parameters:
_XML_ROOT => XML stream where the given tag should be located
_Name => tag name we are looking for.
Returns:
Success => Pointer to the _Name XML element. Failed => NULL.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 272 of file timer.cpp.

References Clear().

TiXmlElement * SG_TRC::CL_TimerVal::XMLSave TiXmlElement *  _XML_ROOT,
std::string  _Name = ""
[virtual]
 

This fonction save CL_TimerVal object into a XML tag called _Name and inserted ibnto the XML stream _XML_ROOT.

Parameters:
_XML_ROOT => XML stream where the object tag will be saved
_Name => name the tag will be saved to.
Returns:
Success => Pointer to the _Name XML element. Failed => NULL.

Reimplemented from SG_TRC::CL_Virtual_Record.

Definition at line 299 of file timer.cpp.


Member Data Documentation

int SG_TRC::CL_TimerVal::returnValue
 

Definition at line 176 of file timer.h.

Referenced by Clear().

bool SG_TRC::CL_TimerVal::succes
 

Definition at line 175 of file timer.h.

Referenced by Clear().

long SG_TRC::CL_TimerVal::tv_sec
 

Time in seconds.

Definition at line 130 of file timer.h.

Referenced by GetStr(), operator!=(), operator+=(), operator-=(), operator=(), operator==(), operator>(), Print(), SetToMax(), and SetToMin().

long SG_TRC::CL_TimerVal::tv_usec
 

Time in microseconds.

Definition at line 131 of file timer.h.

Referenced by GetStr(), operator!=(), operator+=(), operator-=(), operator=(), operator==(), operator>(), Print(), SetToMax(), and SetToMin().


The documentation for this class was generated from the following files:
Generated on Mon Mar 19 23:16:21 2007 for SugoiTracer by  doxygen 1.4.6-NO