Skip to main content
GameDev.net gamedev.net
🔒 Locked

Timer for dualcore?

Started by McZ Nov 29, 2005 at 6:59 AM 0 replies 450+ views
Original Post
McZ
McZ
I have read in some thread here (can't find it again) that the QueryPerformanceCounter(..) is bound to one core which means that there are two different Performance counters on a dual-core chip which would make apps running on dualcore cpus behave strange if the process is moved between the cores by the OS (or the user). So is it posible to create a Timer class that will lock into the first core only? or is it better if the entire application lock itself to the first core.
rmsimpson
rmsimpson
According to the MSDN documentation for QueryPerformanceCounter():

On a multiprocessor computer, it should not matter which processor is called. However, you can get different results on different processors due to bugs in the basic input/output system (BIOS) or the hardware abstraction layer (HAL). To specify processor affinity for a thread, use the SetThreadAffinityMask function

The best and easiest fix is to use SetThreadAffinityMask() to ensure your thread always calls QueryPerformanceCounter() on the same CPU.

Robert

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.