
"Jeff Garland" wrote: [ QueryPerformanceCounter ]
The measurement will be exact if the execution runs on single processor. On multiprocessor there's always chance that the thread moves elsewhere and the measured value will be slightly different.
Yeah, isn't there something I read in the MSDN pages about giving QPC thread affinity to solve this issue? Given the number of dual core chips making their way into the world now this is certain to be a serious problem.
SetThreadAffinityMask() The tool likely needs to check presence of multiple processors, temporarily fix the affinity and then return it back to original state. If the timer will measure time on several levels of call tree only the top timer should do this to avoid expensive system calls. Another problem may be CPU that changes its frequency (Transmeta did this and some CPUs for notebooks may do as well). I think handling this would be over the top for simple timer, though. /Pavel