[ros-diffs] [ion] 24961: - Test for High-Precision Timer (QueryPeformanceCounter). Verifies everything from the Win32 implementation to system call speed to HAL timer accuracy and functionality. Currently fails.

ion at svn.reactos.org ion at svn.reactos.org
Wed Nov 29 08:31:25 CET 2006


Author: ion
Date: Wed Nov 29 10:31:25 2006
New Revision: 24961

URL: http://svn.reactos.org/svn/reactos?rev=24961&view=rev
Log:
- Test for High-Precision Timer (QueryPeformanceCounter). Verifies everything from the Win32 implementation to system call speed to HAL timer accuracy and functionality. Currently fails.

Added:
    trunk/reactos/ntoskrnl/tests/TestTimer.c

Added: trunk/reactos/ntoskrnl/tests/TestTimer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/tests/TestTimer.c?rev=24961&view=auto
==============================================================================
--- trunk/reactos/ntoskrnl/tests/TestTimer.c (added)
+++ trunk/reactos/ntoskrnl/tests/TestTimer.c Wed Nov 29 10:31:25 2006
@@ -1,0 +1,37 @@
+#include <stdio.h>
+#include <conio.h>
+#include <windows.h>
+
+void main ( int argc, char** argv, char** environ )
+{
+ LARGE_INTEGER liFrequency;
+ LARGE_INTEGER liStartTime;
+ LARGE_INTEGER liCurrentTime;
+
+ QueryPerformanceFrequency ( &liFrequency );
+ printf ( "HIGH RESOLUTION PERFOMANCE COUNTER Frequency = %I64d CLOCKS IN SECOND\n",
+	     liFrequency.QuadPart );
+
+ 
+ if (liFrequency.QuadPart == 0)
+ {
+	printf("Your computer does not support High Resolution Performance counter\n");
+	return;
+ }
+
+ printf ( "Press <ENTER> to start test...\n" );
+ getchar();
+
+ printf ( "\nPress any key to quit test\n\n" );
+ QueryPerformanceCounter ( &liStartTime );
+ for (;;)
+ {
+	QueryPerformanceCounter ( &liCurrentTime );
+	printf("Elapsed Time : %8.6f mSec\r",
+          ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart )) );
+	if (_kbhit())
+		break;
+ }
+
+
+}




More information about the Ros-diffs mailing list