added copyright line to top of source files next to license information
[cyclone68000.git] / Pico / Profile.cpp
1 \r
2 // This file is part of the PicoDrive Megadrive Emulator\r
3 \r
4 // Copyright (c) 2011 FinalDave (emudave (at) gmail.com)\r
5 \r
6 // This code is licensed under the GNU General Public License version 2.0 and the MAME License.\r
7 // You can choose the license that has the most advantages for you.\r
8 \r
9 // SVN repository can be found at http://code.google.com/p/cyclone68000/\r
10 \r
11 #include "PicoInt.h"\r
12 \r
13 #ifdef _WIN32_WCE\r
14 \r
15 #pragma warning(disable:4514)\r
16 #pragma warning(push)\r
17 #pragma warning(disable:4201)\r
18 #include <windows.h>\r
19 #pragma warning(pop)\r
20 \r
21 static float Period=0.0f;\r
22 static LARGE_INTEGER TimeStart={0,0};\r
23 \r
24 int ProfileInit()\r
25 {\r
26   LARGE_INTEGER freq={0,0};\r
27 \r
28   QueryPerformanceFrequency(&freq);\r
29 \r
30   Period =(float)freq.HighPart*4294967296.0f;\r
31   Period+=(float)freq.LowPart;\r
32 \r
33   if (Period>=1.0f) Period=1.0f/Period;\r
34   return 0;\r
35 }\r
36 \r
37 int ProfileStart()\r
38 {\r
39   QueryPerformanceCounter(&TimeStart);\r
40 \r
41   return 0;\r
42 }\r
43 \r
44 float ProfileTime()\r
45 {\r
46   LARGE_INTEGER end={0,0};\r
47   int ticks=0;\r
48   float seconds=0.0f;\r
49 \r
50   QueryPerformanceCounter(&end);\r
51 \r
52   ticks=end.LowPart-TimeStart.LowPart;\r
53   seconds=(float)ticks*Period;\r
54 \r
55   return seconds;\r
56 }\r
57 \r
58 #endif\r
59 \r