Sign in to follow this  
McZ

Timer for dualcore?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this