You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 09/07/2001
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: PerformanceCounter.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of PerformanceCounter.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "PerformanceCounter.h"
|
|
#include <stdio.h>
|
|
|
|
CPerformanceCounter::CPerformanceCounter()
|
|
{
|
|
::QueryPerformanceFrequency( &m_liFrequency );
|
|
}
|
|
|
|
CPerformanceCounter::~CPerformanceCounter()
|
|
{
|
|
|
|
}
|
|
|
|
void CPerformanceCounter::Begin()
|
|
{
|
|
::QueryPerformanceCounter( &m_liCounter );
|
|
}
|
|
|
|
double CPerformanceCounter::End()
|
|
{
|
|
LARGE_INTEGER li;
|
|
::QueryPerformanceCounter( &li );
|
|
|
|
double r = (double)(li.QuadPart - m_liCounter.QuadPart) / (double) m_liFrequency.QuadPart;
|
|
|
|
#ifdef _DEBUG
|
|
char pText[10];
|
|
sprintf( pText, "%0.9f\n", r );
|
|
OutputDebugString( pText );
|
|
#endif
|
|
|
|
return r;
|
|
}
|