Boost logo

Boost Users :

Subject: Re: [Boost-users] [Timer] Using progress timers.
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-09-21 13:22:32


On Sep 21, 2011, at 8:05 AM, Lars Viklund wrote:

> On Wed, Sep 21, 2011 at 11:47:35AM +0100, Robert Jones wrote:
>> Hi All,
>> #include <boost/progress.hpp>
>> boost::progress_timer t;
>
>> 0.00 s
>> I was expecting a number >= 5.00 s! What am I missing?
>
> According to the docs for progress_timer, it uses clock().
> The man page for clock(3) on my system claims:
> * The clock() function returns an approximation of processor time used
> * by the program.
>
> That doesn't seem to refer to wall time, so I would recommend you to
> file a bug against this library.

Yes, this is a well known problem with Boost.Timer. Imagine the fun you can have trying to time the speedup of a multicore program with such a timer.

See
http://boost.2283326.n4.nabble.com/system-Boost-Timer-replacement-tt3810315.html
for Beman's proposed replacement. Vicente Botet is also working on a Stopwatches library based on Chrono for much the same purpose.

Cheers,
Gordon



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