Boost logo

Boost :

From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-07-19 13:17:19

Doh! I realize now I was working from an older version of the library (I
was working with

Now I'm working with

Is this still the latest?

I see the timeGetTime implementation has been improved with
timeBeginPeriod and timeEndPeriod.

And I see that best_timer had been added which is in line with my
previous requests.


The header for gpt_device has a small documentation bug.

//! The gtt_device class is based on GetThreadTimes() to compute the time
class gpt_device

Philippe Vaucher wrote:
>> Also the QueryPerformanceCounter device uses millisecond resolution
>> internally. I've adjusted it for microsecond resolution locally.
> Hum I didn't understand what you meant by that.

Sorry I'll be more specific.
QueryPerformanceCounter has around 10 microsecond accuracy on most
systems IIRC.

I'm personally using it to time code where the total code must take less
than 23 ms so to narrow things down it helps to have microsecond resolution.

The qpc_device currently does m_frequency.QuadPart /= 1000 in its
constructor and adds to elapsed by doing:

m_elapsed += posix_time::milliseconds(milliseconds);

I changed it to do m_frequency.QuadPart /= 1000000 in its constructor
and add to elapsed by doing:

m_elapsed += posix_time::microseconds(microseconds);

In terms of what to do when QueryPerformanceCounter leaps I would
probably use the GetTickCount value silently so the class just works
(tm). I'd probably edit the file locally to assert in debug in that case
just for personal curiosity.

There was one more problem with QueryPerformanceCounter on some laptops
including my old one. When the cpu lowered its clock speed to save
battery power the frequency of the timer changed despite the
documentation for QueryPerformanceFrequency explicitly saying the
frequency cannot change while the system is running. I don't have the
laptop anymore so I doubt we'll be able to make and test a fix.
Hopefully this isn't common.


Michael Marcin

Boost list run by bdawes at, gregod at, cpdaniel at, john at