Reactos
at master 37 lines 892 B view raw
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}