Main Page | Class List | File List | Class Members | File Members

PerformanceCounter Class Reference

Encapsulates a LARGE_INTEGER and interface to QueryPerformanceCounter. More...

#include <PerformanceCounter.h>

List of all members.

Public Member Functions

 PerformanceCounter ()
 Queries performance counter and stores the value.
 PerformanceCounter (LONGLONG ll)
 Initializes performance counter with specified value.
 PerformanceCounter (long days, long hours, long minutes, long seconds, long milliseconds, long microseconds)
 Initializes performance counter with specified value calculated from parameters.
PerformanceCounter operator- (const PerformanceCounter &pc) const
PerformanceCounter operator+ (const PerformanceCounter &pc) const
PerformanceCounteroperator+= (const PerformanceCounter &pc)
PerformanceCounteroperator-= (const PerformanceCounter &pc)
bool operator== (const PerformanceCounter &pc) const
bool operator!= (const PerformanceCounter &pc) const
bool operator< (const PerformanceCounter &pc) const
bool operator> (const PerformanceCounter &pc) const
bool operator<= (const PerformanceCounter &pc) const
bool operator>= (const PerformanceCounter &pc) const
void GetAsSecondsAndMicroseconds (long &seconds, long &microseconds)
 Returns counter as seconds and microseconds (1/1000.000 second).
double GetAsMilliseconds ()
 Returns counter as milliseconds.

Static Public Member Functions

static void Init ()
 Initializes performance frequency used for conversion to and from real world units.
static LONGLONG GetFrequency ()
 Returns the performance frequency.
static bool IsInit ()
 Returns true if performance frequence is initialized.

Protected Attributes

LARGE_INTEGER m_Counter

Static Protected Attributes

static LONGLONG m_llFrequency = 0

Friends

std::ostream & operator<< (std::ostream &os, const PerformanceCounter &)
std::ostream & operator<< (std::ostream &, const class format_performance_counter &)


Detailed Description

Encapsulates a LARGE_INTEGER and interface to QueryPerformanceCounter.

Definition at line 12 of file PerformanceCounter.h.


Constructor & Destructor Documentation

PerformanceCounter::PerformanceCounter  )  [inline]
 

Queries performance counter and stores the value.

Definition at line 18 of file PerformanceCounter.h.

References m_Counter.

Referenced by operator+(), and operator-().

PerformanceCounter::PerformanceCounter LONGLONG  ll  )  [inline]
 

Initializes performance counter with specified value.

Definition at line 25 of file PerformanceCounter.h.

References m_Counter.

PerformanceCounter::PerformanceCounter long  days,
long  hours,
long  minutes,
long  seconds,
long  milliseconds,
long  microseconds
[inline]
 

Initializes performance counter with specified value calculated from parameters.

Parameters may overflow (hours > 23, minutes > 59, ...) Static function Init should be called before converting to and from real world time units.

Definition at line 34 of file PerformanceCounter.h.

References GetFrequency(), and m_Counter.

Here is the call graph for this function:


Member Function Documentation

double PerformanceCounter::GetAsMilliseconds  )  [inline]
 

Returns counter as milliseconds.

Definition at line 94 of file PerformanceCounter.h.

References GetFrequency(), and m_Counter.

Referenced by main().

Here is the call graph for this function:

void PerformanceCounter::GetAsSecondsAndMicroseconds long &  seconds,
long &  microseconds
[inline]
 

Returns counter as seconds and microseconds (1/1000.000 second).

Seconds are truncated to long from 64 bit.

Definition at line 86 of file PerformanceCounter.h.

References GetFrequency(), and m_Counter.

Referenced by main().

Here is the call graph for this function:

static LONGLONG PerformanceCounter::GetFrequency  )  [inline, static]
 

Returns the performance frequency.

0 indicates it is not initialized.

Definition at line 105 of file PerformanceCounter.h.

References m_llFrequency.

Referenced by GetAsMilliseconds(), GetAsSecondsAndMicroseconds(), operator<<(), and PerformanceCounter().

void PerformanceCounter::Init  )  [static]
 

Initializes performance frequency used for conversion to and from real world units.

Definition at line 9 of file PerformanceCounter.cpp.

References m_llFrequency.

Referenced by main(), and operator<<().

static bool PerformanceCounter::IsInit  )  [inline, static]
 

Returns true if performance frequence is initialized.

Definition at line 109 of file PerformanceCounter.h.

References m_llFrequency.

Referenced by operator<<().

bool PerformanceCounter::operator!= const PerformanceCounter pc  )  const [inline]
 

Definition at line 62 of file PerformanceCounter.h.

References m_Counter.

PerformanceCounter PerformanceCounter::operator+ const PerformanceCounter pc  )  const [inline]
 

Definition at line 44 of file PerformanceCounter.h.

References m_Counter, and PerformanceCounter().

Here is the call graph for this function:

PerformanceCounter& PerformanceCounter::operator+= const PerformanceCounter pc  )  [inline]
 

Definition at line 48 of file PerformanceCounter.h.

References m_Counter.

PerformanceCounter PerformanceCounter::operator- const PerformanceCounter pc  )  const [inline]
 

Definition at line 40 of file PerformanceCounter.h.

References m_Counter, and PerformanceCounter().

Here is the call graph for this function:

PerformanceCounter& PerformanceCounter::operator-= const PerformanceCounter pc  )  [inline]
 

Definition at line 53 of file PerformanceCounter.h.

References m_Counter.

bool PerformanceCounter::operator< const PerformanceCounter pc  )  const [inline]
 

Definition at line 66 of file PerformanceCounter.h.

References m_Counter.

bool PerformanceCounter::operator<= const PerformanceCounter pc  )  const [inline]
 

Definition at line 74 of file PerformanceCounter.h.

References m_Counter.

bool PerformanceCounter::operator== const PerformanceCounter pc  )  const [inline]
 

Definition at line 58 of file PerformanceCounter.h.

References m_Counter.

bool PerformanceCounter::operator> const PerformanceCounter pc  )  const [inline]
 

Definition at line 70 of file PerformanceCounter.h.

References m_Counter.

bool PerformanceCounter::operator>= const PerformanceCounter pc  )  const [inline]
 

Definition at line 78 of file PerformanceCounter.h.

References m_Counter.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  ,
const class format_performance_counter
[friend]
 

std::ostream& operator<< std::ostream &  os,
const PerformanceCounter pc
[friend]
 

Definition at line 16 of file PerformanceCounter.cpp.


Member Data Documentation

LARGE_INTEGER PerformanceCounter::m_Counter [protected]
 

Definition at line 111 of file PerformanceCounter.h.

Referenced by GetAsMilliseconds(), GetAsSecondsAndMicroseconds(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator<(), operator<<(), operator<=(), operator==(), operator>(), operator>=(), and PerformanceCounter().

LONGLONG PerformanceCounter::m_llFrequency = 0 [static, protected]
 

Definition at line 7 of file PerformanceCounter.cpp.

Referenced by GetFrequency(), Init(), and IsInit().


The documentation for this class was generated from the following files:
Generated on Sun Jun 26 13:44:02 2005 for pingem by  doxygen 1.4.3