|
|
1.1 root 1: /*
2: Hatari
3:
4: Debug Timer functions
5: */
6:
7: #include "main.h"
8:
9: #define LARGE_INTEGER long long /* ???? */
10: #define LONGLONG long long /* ???? */
11:
12: #define QueryPerformanceFrequency(x) /* FIXME: What the !$*? is this? */
13: #define QueryPerformanceCounter(x) /* Dito */
14:
15:
16: LARGE_INTEGER StartCount,EndCount,Frequency;
17:
18: //-----------------------------------------------------------------------
19: /*
20: Initialise debug timer
21: */
22: void Timer_Init(void)
23: {
24: #ifdef FIND_PERFORMANCE
25: // Find frequency to calculate 'milli-second' results
26: QueryPerformanceFrequency(&Frequency);
27: #endif
28: }
29:
30: //-----------------------------------------------------------------------
31: /*
32: Start timer
33: */
34: void Timer_Start()
35: {
36: // Start timer
37: QueryPerformanceCounter(&StartCount);
38: }
39:
40: //-----------------------------------------------------------------------
41: /*
42: Stop timer, return as 'milli-second' count(float)
43: */
44: float Timer_Stop()
45: {
46: LONGLONG a,b;
47:
48: // End timer
49: QueryPerformanceCounter(&EndCount);
50:
51: // Find time and frequency
52: a = EndCount /*.QuadPart*/ - StartCount /*.QuadPart*/; /* FIXME */
53: b = Frequency /*.QuadPart*/ ;
54:
55: return( ((float)a/(float)b) * 1000.0f ); /* as 'ms' */
56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.