1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// StopWatch3.cpp: implementation of the CStopWatch class.
//
//////////////////////////////////////////////////////////////////////
 
#include "stdafx.h"
#include "StopWatch3.h"
 
 
 
 
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
 
CStopWatch::CStopWatch()
{
    m_swFreq.LowPart = m_swFreq.HighPart = 0;
    m_swStart = m_swFreq;
    m_swEnd = m_swFreq;
    m_fTimeforDuration = 0;
 
    QueryPerformanceFrequency(&m_swFreq);
//    m_swFreq.QuadPart = (LONGLONG)(2.41f*1024*1024*1024);
}
 
CStopWatch::~CStopWatch()
{
}
 
void CStopWatch::Start(void)
{
    QueryPerformanceCounter(&m_swStart);
}
 
void CStopWatch::End(void)
{
    QueryPerformanceCounter(&m_swEnd);
    m_fTimeforDuration = (m_swEnd.QuadPart - m_swStart.QuadPart)/(float)m_swFreq.QuadPart; 
}