Operator Console
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Timer Class Reference

a timer class for getting the elapsed time between events More...

#include <Timer.h>

Public Member Functions

 Timer (void)
 
virtual ~Timer (void)
 
void Start ()
 
void Stop ()
 
void Get (long long *ms)
 gets the elapsed time in milliseconds More...
 
void Get (double *sec)
 gets the elapsed time in seconds More...
 
void Get (CString *str)
 gets the elapsed time in a formatted string More...
 
 Timer (void)
 
virtual ~Timer (void)
 
void Start ()
 
void Stop ()
 
void Get (long long *ms)
 
void Get (double *sec)
 
void Get (CString *str)
 

Protected Member Functions

void Elapsed ()
 calculates elapsed time in milliseconds More...
 
void Elapsed ()
 

Protected Attributes

struct _timeb m_start
 
struct _timeb m_stop
 
long long m_elapsed
 elapsed time in ms More...
 

Detailed Description

a timer class for getting the elapsed time between events

Constructor & Destructor Documentation

Timer::Timer ( void  )

References m_elapsed, m_start, and m_stop.

25 {
26  memset(&m_start, 0, sizeof(m_start));
27  memset(&m_stop, 0, sizeof(m_stop));
28  m_elapsed = 0;
29 }
struct _timeb m_stop
Definition: Timer.h:45
struct _timeb m_start
Definition: Timer.h:44
long long m_elapsed
elapsed time in ms
Definition: Timer.h:46
Timer::~Timer ( void  )
virtual
32 {
33 }
Timer::Timer ( void  )
virtual Timer::~Timer ( void  )
virtual

Member Function Documentation

void Timer::Elapsed ( )
protected

calculates elapsed time in milliseconds

References m_elapsed, m_start, and m_stop.

Referenced by Stop().

50 {
51  long long start = (m_start.time * 1000) + m_start.millitm;
52  long long stop = (m_stop.time * 1000) + m_stop.millitm;
53 
54  m_elapsed = stop - start;
55 }
struct _timeb m_stop
Definition: Timer.h:45
struct _timeb m_start
Definition: Timer.h:44
long long m_elapsed
elapsed time in ms
Definition: Timer.h:46

Here is the caller graph for this function:

void Timer::Elapsed ( )
protected
void Timer::Get ( long long *  ms)
void Timer::Get ( long long *  ms)

gets the elapsed time in milliseconds

References m_elapsed.

Referenced by ImageTest::ThreadProc().

72 {
73  if (ms != NULL)
74  {
75  *ms = m_elapsed;
76  }
77 }
long long m_elapsed
elapsed time in ms
Definition: Timer.h:46

Here is the caller graph for this function:

void Timer::Get ( double *  sec)

gets the elapsed time in seconds

References m_elapsed.

61 {
62  if (sec != NULL)
63  {
64  *sec = (double)m_elapsed / 1000.;
65  }
66 }
long long m_elapsed
elapsed time in ms
Definition: Timer.h:46
void Timer::Get ( double *  sec)
void Timer::Get ( CString *  str)
void Timer::Get ( CString *  str)

gets the elapsed time in a formatted string

References m_elapsed.

83 {
84  if (str != NULL)
85  {
86  str->Format("%lu.%03u", (unsigned long)(m_elapsed / 1000), (unsigned)(m_elapsed % 1000));
87  }
88 }
long long m_elapsed
elapsed time in ms
Definition: Timer.h:46
void Timer::Start ( )
void Timer::Start ( )

References m_start.

Referenced by ImageTest::ThreadProc().

36 {
37  _ftime_s(&m_start);
38 }
struct _timeb m_start
Definition: Timer.h:44

Here is the caller graph for this function:

void Timer::Stop ( )
void Timer::Stop ( )

References Elapsed(), and m_stop.

Referenced by ImageTest::ThreadProc().

41 {
42  _ftime_s(&m_stop);
43  Elapsed();
44 }
struct _timeb m_stop
Definition: Timer.h:45
void Elapsed()
calculates elapsed time in milliseconds
Definition: Timer.cpp:49

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

long long Timer::m_elapsed
protected

elapsed time in ms

Referenced by Elapsed(), Get(), and Timer().

struct _timeb Timer::m_start
protected

Referenced by Elapsed(), Start(), and Timer().

struct _timeb Timer::m_stop
protected

Referenced by Elapsed(), Stop(), and Timer().


The documentation for this class was generated from the following files: