QueryPerformanceCounter() vs. GetTickCount(),
Members - Reputation: 138
Posted 13 November 2005 - 04:56 PM
Members - Reputation: 761
Posted 13 November 2005 - 05:59 PM
I've never used GetTickCount for timing purposes so I can't comment on how suitable it is for this purpose. Instead of GetTickCount, I normally use timeGetTime, along with timeBeginPeriod and timeEndPeriod. For most purposes in the games I've made, a resolution of 5 ms has been more than suitable, and timeGetTime can be set to that or lower.
Perhaps the best solution is to use a combination of the methods, one as a rough check against the other.
Members - Reputation: 3051
Posted 13 November 2005 - 08:18 PM
One problem I can attest to about QPC, is that AMD64x2 systems (Pentium D too?) seem to have problems with it. This comes from dual-core systems having 2 high performance timers, and so the application gets conflicting timing data when the thread is switched between processors.
-I have heard there are fixes for it, but I have yet to find one that removes the problem in all cases (assuming external attempt to fix the problem).
There still exist programs using QPC and RSDC that get buggy results.
Though you can still use QPC if you make sure that whatever thread your timer code is running in, you make your program set its own affinity to a single processor.
Answering some of your questions
-QPC is acurate to less than 1ms.
-GetTickCount() seems to vary. But has a max resolution of 1ms, but is often several ms.
-timeGetTime() can be forced to have a 1ms resolution.