Author: Dann Corbit
Date: 18:48:17 01/25/00
Go up one level in this thread
On January 25, 2000 at 21:28:29, Ernst A. Heinz wrote: [snip] >Tom, I am no NT guru but I cannot believe your suspicion. > >This would mean that NT inherently breaks the ANSI C standard. Actually, clock() under NT does not break the ANSI C standard, but the standard is vague on a number of things. Among these is the value for CLOCKS_PER_SECOND (which roughly defines the resolution of the timer). If you are trying to time a large number of very fast events, you should get the multimedia kit and use a high resolution timer. The actual resolution for clock() is very bad. If the events themselves are very quick, it can look almost like a random number generator that produces mostly zeros. Here is some data on timing from the MS help files: "Timers With general-purpose operating systems that use virtual memory and caching algorithms, it is often difficult to ensure that events will take place within specified periods of time. Windows NT offers several timers that can be used to obtain more deterministic time intervals for managing events in real-time environments. These timers generate software interrupts from the kernel. Windows NT Workstation version 3.5 makes it possible for applications to use the basic system timer with the GetTickCount( ) API. The resolution of this timer is 10 milliseconds. Several CPUs support a high-resolution counter that can be used to get very granular resolution. The Win32 QueryPerformanceCounter( ) API returns the resolution of a high-resolution performance counter. For IntelĀ®-based CPUs, the resolution is about 0.8 microseconds. For MIPSĀ®-based CPUs, the resolution is about twice the clock speed of the processor. You need to call QueryPerformanceFrequency( ) to get the frequency of the high-resolution performance counter." The performance counter is called like this (again from the MS help files): "BOOL QueryPerformanceFrequency( LARGE_INTEGER *lpFrequency // address of current frequency ); Parameters lpFrequency Pointer to a variable that the function sets, in counts per second, to the current performance-counter frequency. If the installed hardware does not support a high-resolution performance counter, this parameter can be to zero. Return Values If the installed hardware supports a high-resolution performance counter, the return value is nonzero. If the installed hardware does not support a high-resolution performance counter, the return value is zero." The problem with the performance counter is that you may not have one. It's optional.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.