ReactOS  0.4.15-dev-3303-g1ade494
TestTimer.c File Reference
#include <stdio.h>
#include <conio.h>
#include <windows.h>
Include dependency graph for TestTimer.c:

Go to the source code of this file.

Functions

void main (int argc, char **argv, char **environ)
 

Function Documentation

◆ main()

void main ( int  argc,
char **  argv,
char **  environ 
)

Definition at line 5 of file TestTimer.c.

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 }
_CRTIMP int __cdecl _kbhit(void)
Definition: kbhit.c:21
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
_Check_return_ _CRTIMP int __cdecl getchar(void)
Definition: file.c:3627
LONGLONG QuadPart
Definition: typedefs.h:114
#define printf
Definition: config.h:203