annotate 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 |
|
rev |
line source |
rlm@1
|
1 // CPerfTimer - a simple Win32 performance counter wrapper
|
rlm@1
|
2 // by Dean Wyant dwyant@mindspring.com
|
rlm@1
|
3
|
rlm@1
|
4 #include "stdafx.h"
|
rlm@1
|
5 #include "PerfTimer.h"
|
rlm@1
|
6
|
rlm@1
|
7 // Declare and initialize static member vars that get set only once and never change
|
rlm@1
|
8 __int64 CPerfTimer::m_Freq = 0;
|
rlm@1
|
9 __int64 CPerfTimer::m_Adjust = 0;
|
rlm@1
|
10
|
rlm@1
|
11 // All functions defined inline for speed. After all, the performance counter is
|
rlm@1
|
12 // supposed to be able to time very short events fairly accurately.
|
rlm@1
|
13
|
rlm@1
|
14
|
rlm@1
|
15
|
rlm@1
|
16 BOOL CPerfTimer::IsSupported()
|
rlm@1
|
17 { // Returns FALSE if performance counter not supported.
|
rlm@1
|
18 // Call after constructing at least one CPerfTimer
|
rlm@1
|
19 return (m_Freq > 1);
|
rlm@1
|
20 }
|
rlm@1
|
21
|
rlm@1
|
22 const double CPerfTimer::Resolution()
|
rlm@1
|
23 { // Returns timer resolution in seconds
|
rlm@1
|
24 return 1.0/(double)m_Freq;
|
rlm@1
|
25 }
|
rlm@1
|
26
|
rlm@1
|
27 const double CPerfTimer::Resolutionms()
|
rlm@1
|
28 { // Returns timer resolution in milliseconds
|
rlm@1
|
29 return 1000.0/(double)m_Freq;
|
rlm@1
|
30 }
|
rlm@1
|
31
|
rlm@1
|
32 const double CPerfTimer::Resolutionus()
|
rlm@1
|
33 { // Returns timer resolution in microseconds
|
rlm@1
|
34 return 1000000.0/(double)m_Freq;
|
rlm@1
|
35 }
|