view src/win32/PerfTimer.cpp @ 4:5f6f2134e8ce

apu appears to not be used
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:35:58 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // CPerfTimer - a simple Win32 performance counter wrapper
2 // by Dean Wyant dwyant@mindspring.com
4 #include "stdafx.h"
5 #include "PerfTimer.h"
7 // Declare and initialize static member vars that get set only once and never change
8 __int64 CPerfTimer::m_Freq = 0;
9 __int64 CPerfTimer::m_Adjust = 0;
11 // All functions defined inline for speed. After all, the performance counter is
12 // 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 CPerfTimer
19 return (m_Freq > 1);
20 }
22 const double CPerfTimer::Resolution()
23 { // Returns timer resolution in seconds
24 return 1.0/(double)m_Freq;
25 }
27 const double CPerfTimer::Resolutionms()
28 { // Returns timer resolution in milliseconds
29 return 1000.0/(double)m_Freq;
30 }
32 const double CPerfTimer::Resolutionus()
33 { // Returns timer resolution in microseconds
34 return 1000000.0/(double)m_Freq;
35 }