Boost logo

Boost :

From: Martin Slater (mslater_at_[hidden])
Date: 2005-02-12 10:53:35


>>
>>> On Fri, 11 Feb 2005 19:30:36 -0500, christopher diggins wrote:
>>> [...]
>>> std::clock() and I assume QueryPerformanceCounter() give you an
>>> amount of
>>> clock ticks. This number is only incremented when the CPU works on
>>> your
>>> task.
>>
>> AFAIK your assumption is wrong.
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancecounter.asp

watch the line wrap. QueryPerformanceCounter uses the CPU clock and is
not per task but system wide.

> Can you point me to documentation which supports your assertion?
>
>> The only problem with QueryPerformanceCounter() is that it can "jump"
>> on some chipsets.
>
>
> I believe this problem is perhaps not restricted to
> QueryPerformanceCounter() but to any counter counting mechanism, as
> the problem is at the chipset level not the API level.

No, there is a very particualar problem relating to
QueryPerformanceCounter() on some (old?) chipsets the can cause it go
backwards in time and wrap after approximately 20 minutes. I reported
this to microsoft some years ago and it was confirmed an issue. (at the
time only happened to me on one particualar celeron / motherboard
configuration). By backwards in time I mean you could call the counter
in a loop and have a reported time earlier than one got the previous
iteration. This bit me on commercial code and I resorted to
    timeBeginPeriod(1);
    timeGetTime();
instead with no issues.

Martin


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