Subject: Re: [boost] [Boost.Timer] Why timer doesn't have a specific windows version using QueryPerformanceCounter() and QueryPerformanceFrequency()?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-11-04 07:27:11
> Boost.Timer is based on the C function clock(). On windows,
> this function gives a precision of 1 millisecond only as
> CLOCKS_PER_SEC is equal to 1000.
> Why Boost.Timer doesn't use for windows
> QueryPerformanceCounter() and QueryPerformanceFrequency()?
> These functions give a precision around 2 microseconds.
>From the Boost.Timer documentation's Rationale section:
"There have been several requests for platform specific implementations to use supposedly high-performance timers from the operating system API. John Maddock submitted an implementation using the Win32 API. Tests showed that while the precision of these timers was high, the latency was sometimes very much higher than for the std::clock() function, and that is very bad. Furthermore, results using the Win32 API were very dependent on both the compiler (Microsoft and Borland were tested) and the operating system version (Windows NT, Windows 95, etc.) Thus the std::clock() function was much more reliable, and so was retained even on this platform with its own timer API."
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk