|
Boost : |
From: Russell Hind (rhind_at_[hidden])
Date: 2003-03-24 09:46:14
Beman Dawes wrote:
>
> Be careful. At least with some older versions of Windows, the execution
> time for some of the Windows time related API's was so large that the
> useful resolution was nowhere near the apparent claimed resolution.
>
> If a function that is supposed to measure time in microseconds takes
> several milliseconds to execute, it seems to me the useful resolution is
> really milliseconds rather than microseconds.
>
> It might be interesting to write a little test program and run it on
> modern versions of Windows to see it this problem still exists.
>
Does this help?
I've just run this quickly on my PIII 800 running Win2K SP3 and worse
case for 1,000,000 calls to QueryPerformanceCounter was 1.92seconds,
usually between 1.55 and 1.65 seconds (10 runs).
LARGE_INTEGER Start, End, Temp;
QueryPerformanceCounter(&Start);
for (unsigned int i = 0; i < 1000000; ++i)
{
QueryPerformanceCounter(&Temp);
}
QueryPerformanceCounter(&End);
LARGE_INTEGER Frequency;
QueryPerformanceFrequency(&Frequency);
double Time = (static_cast<double>(End.QuadPart) - Start.QuadPart) /
Frequency.QuadPart;
Doesn't seem to bad to me. Can't test on any more OSes as this is all
we have installed.
Cheers
Russell
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk