Boost logo

Boost :

From: pinkfloydhomer_at_[hidden]
Date: 2001-03-03 09:56:17

--- In boost_at_y..., Beman Dawes <beman_at_e...> wrote:
> At 01:30 PM 9/7/2000 +0000, William Kempf wrote:
> >I considered this, but stuck with GetTickCount() because it is
> >platform specific code and GetTickCount() returns milliseconds,
> >whereas clock() would have to be used in a mathematical
> >using CLOCKS_PER_SEC to determine milliseconds. So GetTickCount()
> >seemed safe and much easier to deal with for this specific case.
> As a point of information, John Maddock sent me a version of the
> timer functions implemented using Win32 native calls to
> QueryPerformanceCounter rather than std::clock().
> We ran some timings, and the results were quite surprising:
> * For a given compiler, clock() was sometimes dramatically
(10 times)
> faster that the native function. This is counter intuitive since
> native function had better resolution.
> * Which was faster varied from compiler to compiler. On
> machine, the fastest clock() was over 70 times faster that the
> * Which was faster varied from platform to platform. The
> characteristics of the timings on Win 95/98 were different from the
Win NT
> timings, even when adjusted for differing hardware.
> The results were so varied that about the only thing you could say
is that
> to truly optimize timing, you might have to make the clock() vs
> QueryPerformanceCounter() trade-off as late as run-time.

Also, std::clock() and GetTickCount() does not perform the same
function. std::clock() might give the CPU time of the process of the
program, while GetTickCount() measures "real-time".

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