Boost logo

Boost Users :

Subject: Re: [Boost-users] A problem on using boost timer (different timeintervals were showed). Can any one with kindness help me?
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2009-09-25 01:52:19


Dominique Devienne wrote:
> On Thu, Sep 24, 2009 at 3:01 AM, Johan Nilsson

[snip]

>>
>> Run the program's main body many times and divide the total time
>> with the number of executions.
>
> Yes, the around 15ms resolution of the default Windows timer is too
> coarse IMHO, given the multi-GHz CPUs of today. If what you time
> fully happens
> between two ticks,
> the timer says zero indeed.
>
> http://en.wikipedia.org/wiki/Andrew_Koenig wrote a few years back a
> nice 6 article
> series on benchmarking (was it Byte, DrDoobs, CUJ, or OOC, I don't
> recall), and showed you can spin until the clock ticks (up to 15ms
> worth..., was
> around 30,000
> iterations at that time, in Java code), do your short op, then spin
> again until the
> next clock tick, and by approximating the time a spin iter takes, you
> can get a fairly accurate measurement. Also talked about taking N
> samples, throwing out the extremes, and then taking the median I
> think.
>
> Windows does support a high resolution timer, but I could never find
> a good impl to re-use, and it's not portable of course. I wish Boost
> provided such
> a high res
> timer in a portable manner :) --DD

[shameless self-plug]

http://msdn.microsoft.com/en-us/magazine/cc163996.aspx

The implementation has its quirks, but the basic functionality is there
(modulo a few bugs). It's not portable though.

/ Johan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net