Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2006-06-26 14:54:01


"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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk