Mercurial > vba-linux
view src/win32/PerfTimer.cpp @ 2:3549bbe597ed
adding makefile.am
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:47 -0600 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
1 // CPerfTimer - a simple Win32 performance counter wrapper2 // by Dean Wyant dwyant@mindspring.com4 #include "stdafx.h"5 #include "PerfTimer.h"7 // Declare and initialize static member vars that get set only once and never change8 __int64 CPerfTimer::m_Freq = 0;9 __int64 CPerfTimer::m_Adjust = 0;11 // All functions defined inline for speed. After all, the performance counter is12 // supposed to be able to time very short events fairly accurately.16 BOOL CPerfTimer::IsSupported()17 { // Returns FALSE if performance counter not supported.18 // Call after constructing at least one CPerfTimer19 return (m_Freq > 1);20 }22 const double CPerfTimer::Resolution()23 { // Returns timer resolution in seconds24 return 1.0/(double)m_Freq;25 }27 const double CPerfTimer::Resolutionms()28 { // Returns timer resolution in milliseconds29 return 1000.0/(double)m_Freq;30 }32 const double CPerfTimer::Resolutionus()33 { // Returns timer resolution in microseconds34 return 1000000.0/(double)m_Freq;35 }