resolution 这里指的精度,分辨率的意思吧 The system has WM_TIMER which gives about 50ms resolution, and Multimedia Timers which can do about 1ms. 1)For using the Multimidia: To determine the minimum and maximum timer resolutions supported by the timer services, use the timeGetDevCaps function. This function fills the wPeriodMin and wPeriodMax members of the TIMECAPS structure with the minimum and maximum resolutions. This range can vary across computers and Windows platforms. After you determine the minimum and maximum available timer resolutions, you must establish the minimum resolution you want your application to use. Use the timeBeginPeriod and timeEndPeriod functions to set and clear this resolution. You must match each call to timeBeginPeriod with a call to timeEndPeriod, specifying the same minimum resolution in both calls. An application can make multiple timeBeginPeriod calls, as long as each call is matched with a call to timeEndPeriod. In both timeBeginPeriod and timeEndPeriod, the uPeriod parameter indicates the minimum timer resolution, in milliseconds. You can specify any timer resolution value within the range supported by the timer.(主持人注,参考QA001022 "VC++中使用高精度定时器")
2)There are a few instructions included in the Pentium instruction set,for precise timing and delays. Those are instructions to read the present state of a high-speed counter and also to get the frequency of the counter. These instructions are wrapped in C++ by the two functions called: QueryPerformanceCounter and QueryPerformanceFrequency.
3)Using the GetTickCount() It is possible to adjust a simple for() loop that contains _asm {NOP} and get a reasonable delay accuracy.
Note: The timer releated functions are always processor independent. So in your code, you'd better dynamically calculate your delay count based on the runtime test.
http://www.vckbase.com/document/viewdoc/?id=1039
http://www.vckbase.com/document/viewdoc/?id=1301
The system has WM_TIMER which gives about 50ms resolution, and Multimedia Timers which can do about 1ms.
1)For using the Multimidia:
To determine the minimum and maximum timer resolutions supported by the timer services, use the timeGetDevCaps function. This function fills the wPeriodMin and wPeriodMax members of the TIMECAPS structure with the minimum and maximum resolutions. This range can vary across computers and Windows platforms.
After you determine the minimum and maximum available timer resolutions, you must establish the minimum resolution you want your application to use. Use the timeBeginPeriod and timeEndPeriod functions to set and clear this resolution. You must match each call to timeBeginPeriod with a call to timeEndPeriod, specifying the same minimum resolution in both calls. An application can make multiple timeBeginPeriod calls, as long as each call is matched with a call to timeEndPeriod.
In both timeBeginPeriod and timeEndPeriod, the uPeriod parameter indicates the minimum timer resolution, in milliseconds. You can specify any timer resolution value within the range supported by the timer.(主持人注,参考QA001022 "VC++中使用高精度定时器")
2)There are a few instructions included in the Pentium instruction set,for precise timing and delays. Those are instructions to read the present state of a high-speed counter and also to get the frequency of the counter. These instructions are wrapped in C++ by the two functions called: QueryPerformanceCounter and QueryPerformanceFrequency.
3)Using the GetTickCount()
It is possible to adjust a simple for() loop that contains _asm {NOP} and get a reasonable delay accuracy.
Note: The timer releated functions are always processor independent. So in your code, you'd better dynamically calculate your delay count based on the runtime test.
thx
////
resolution 这里指的精度,分辨率的意思吧