All pastes #675835 Raw Edit

Mine

public text v1 · immutable
#675835 ·published 2007-08-30 14:59 UTC
rendered paste body
// from the changelog

 - Hires timers are disabled on windows systems with more than one CPU, due to bugs
   in the BIOS of many multi-core motherboards. To enable hires timers in your project, 
   use SetProcessAffinityMask to set to use only one CPU before creating the device.


// from os.cpp


	void Timer::initTimer()
	{
		// disable hires timer on multiple core systems, bios bugs result in bad hires timers.
		SYSTEM_INFO sysinfo;
		DWORD affinity, sysaffinity;
		GetSystemInfo(&sysinfo);
		s32 affinityCount = 0;

		// count the processors that can be used by this process
		if (GetProcessAffinityMask( GetCurrentProcess(), &affinity, &sysaffinity ))
		{
			for (u32 i=0; i<32; ++i)
			{
				if ((1<<i) & affinity)
					affinityCount++;
			}
		}

		if (sysinfo.dwNumberOfProcessors == 1 || affinityCount == 1)
		{
			HighPerformanceTimerSupport = QueryPerformanceFrequency(&HighPerformanceFreq);
		}
		else
		{
			HighPerformanceTimerSupport = false;
		}
		initVirtualTimer();
	}