ReactOS 0.4.15-dev-7918-g2a2556c
Timer Class Reference

#include <cppunit_timer.h>

Public Member Functions

 Timer ()
 
void start ()
 
void restart ()
 
void stop ()
 
double elapsedMilliseconds () const
 

Static Public Member Functions

static bool supported ()
 

Detailed Description

Definition at line 24 of file cppunit_timer.h.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )
inline

Definition at line 26 of file cppunit_timer.h.

26 {
27#if defined (CPPUNIT_WIN32_TIMER)
28 m_start.LowPart = m_restart.LowPart = m_stop.LowPart = 0;
29 m_start.HighPart = m_restart.HighPart = m_stop.HighPart = 0;
30 QueryPerformanceFrequency(&m_frequency);
31#endif
32 }
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45

Referenced by CTEInitTimer(), CTEStartTimer(), IoDeleteDevice(), MiniTimerDpcFunction(), NdisCancelTimer(), NdisInitializeTimer(), NdisMCancelTimer(), NdisMInitializeTimer(), NdisMSetPeriodicTimer(), NdisMSetTimer(), and NdisSetTimer().

Member Function Documentation

◆ elapsedMilliseconds()

double Timer::elapsedMilliseconds ( ) const
inline

Definition at line 75 of file cppunit_timer.h.

75 {
76#if defined (CPPUNIT_WIN32_TIMER)
77 LARGE_INTEGER elapsed;
78 elapsed.HighPart = m_stop.HighPart - m_start.HighPart;
79 elapsed.LowPart = m_stop.LowPart - m_start.LowPart;
80 return (double)elapsed.QuadPart / (double)m_frequency.QuadPart * 1000;
81#else
82 return 0;
83#endif
84 }
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106

Referenced by FileReporter::end(), and FileReporter::printSummary().

◆ restart()

void Timer::restart ( )
inline

Definition at line 40 of file cppunit_timer.h.

40 {
41#if defined (CPPUNIT_WIN32_TIMER)
42 QueryPerformanceCounter(&m_restart);
43 if (m_start.HighPart == 0 && m_start.LowPart == 0) {
44 m_start = m_restart;
45 }
46#endif
47 }
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23

Referenced by FileReporter::progress().

◆ start()

void Timer::start ( )
inline

Definition at line 34 of file cppunit_timer.h.

34 {
35#if defined (CPPUNIT_WIN32_TIMER)
37#endif
38 }

Referenced by FileReporter::progress().

◆ stop()

void Timer::stop ( )
inline

Definition at line 49 of file cppunit_timer.h.

49 {
50#if defined (CPPUNIT_WIN32_TIMER)
53 if ((m_stop.HighPart != 0 || m_stop.LowPart != 0) &&
54 m_restart.HighPart != 0 && m_restart.LowPart != 0) {
55 m_stop.HighPart += (stop.HighPart - m_restart.HighPart);
56 if (stop.LowPart < m_restart.LowPart) {
57 if (m_restart.LowPart - stop.LowPart > m_stop.LowPart) {
58 m_stop.HighPart -= 1;
59 }
60 m_stop.LowPart -= m_restart.LowPart - stop.LowPart;
61 }
62 else {
63 if (stop.LowPart - m_restart.LowPart > 0xFFFFFFFF - m_stop.LowPart) {
64 m_stop.HighPart += 1;
65 }
66 m_stop.LowPart += stop.LowPart - m_restart.LowPart;
67 }
68 }
69 else {
70 m_stop = stop;
71 }
72#endif
73 }
void stop()
Definition: cppunit_timer.h:49

Referenced by FileReporter::end(), and stop().

◆ supported()

static bool Timer::supported ( )
inlinestatic

Definition at line 86 of file cppunit_timer.h.

86 {
87#if defined (CPPUNIT_WIN32_TIMER)
88 return true;
89#else
90 return false;
91#endif
92 }

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