ReactOS 0.4.15-dev-7953-g1f49173
TestTimer.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <conio.h>
3#include <windows.h>
4
5void main ( int argc, char** argv, char** environ )
6{
7 LARGE_INTEGER liFrequency;
8 LARGE_INTEGER liStartTime;
9 LARGE_INTEGER liCurrentTime;
10
11 QueryPerformanceFrequency ( &liFrequency );
12 printf ( "HIGH RESOLUTION PERFOMANCE COUNTER Frequency = %I64d CLOCKS IN SECOND\n",
13 liFrequency.QuadPart );
14
15
16 if (liFrequency.QuadPart == 0)
17 {
18 printf("Your computer does not support High Resolution Performance counter\n");
19 return;
20 }
21
22 printf ( "Press <ENTER> to start test...\n" );
23 getchar();
24
25 printf ( "\nPress any key to quit test\n\n" );
26 QueryPerformanceCounter ( &liStartTime );
27 for (;;)
28 {
29 QueryPerformanceCounter ( &liCurrentTime );
30 printf("Elapsed Time : %8.6f mSec\r",
31 ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart )) );
32 if (_kbhit())
33 break;
34 }
35
36
37}
static int argc
Definition: ServiceArgs.c:12
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
int main()
Definition: test.c:6
#define printf
Definition: freeldr.h:97
_Check_return_ _CRTIMP int __cdecl getchar(void)
Definition: file.c:3629
#define environ
Definition: stdlib.h:1348
#define argv
Definition: mplay32.c:18
_CRTIMP int __cdecl _kbhit(void)
Definition: kbhit.c:21
LONGLONG QuadPart
Definition: typedefs.h:114