Boost logo

Boost :

Subject: Re: [boost] [stopwatches] About reducing the scope of the library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-09-10 11:06:56

Le 10/09/11 10:02, Gordon Woodhull a écrit :
> On Sep 9, 2011, at 3:10 PM, "Vicente J. Botet Escriba"<vicente.botet_at_[hidden]> wrote:
>> Le 08/09/11 04:30, Gordon Woodhull a écrit :
>>> On Sep 7, 2011, at 5:35 PM, "Vicente J. Botet Escriba"<vicente.botet_at_[hidden]> wrote:
>>>> Do you think that it is worth proposing an addition to Boost.Chrono that provides only stopwatches (without reporting)?
>>> It would be really nice to have a replacement for Boost.Timer ASAP. Perhaps it would make sense to introduce something simple as a Chrono example, and then decide how to expand it into a library later?
>> I don't know what do you consider a simple example.
> Oops, I meant: yes please make stopwatches a sublibrary of chrono and then see if it needs to set off on its own.
Yes, this is a good idea.
> All I want is a replacement for boost::timer, for writing benchmarks. I never used the progress_timer so I don't know about the reporting side of Boost.Timer, never wanted it. I want a simple class that keeps track of elapsed time so I don't have to even do one subtraction.
> In one quick pass of the Stopwatches documentation, I can't find anything that doesn't do automatic reporting. I figure there must be a class in there that looks a lot like boost::timer or the one in Chrono's "key is struck" example, which is what your original question must be proposing.
I guess this is due to the fact I used everytime the reporting
facilities. The equivalent of the timer class is stopwatch. Here follows
un example

using namespace boost::chrono;
using namespace boost::stopwatches;

int f1(long j) {
     stopwatch|| <mailbox:///Users/viboes/Library/Thunderbird/Profiles/7k7xdbkm.default/Mail/><system_clock> sw;

     for ( long i = 0; i < j; ++i )
         std::sqrt( 123.456L ); // burn some time

     return milliseconds(sw.elapsed()).count(); // retun the number of milliseconds

elapsed() returns the elapsed time since the stopwatch was created.

Does this respond to your expectations?
> I find Boost.Timer kind of buggy. It was reporting CPU time on Linux, so I couldn't benchmark a parallelized program. I feel it has other problems. I thought Chrono was supposed to replace it, but it's still a little verbose for this very simple task.
My first proposal of Boost.Chrono included Stopwatches, but some on this
list sugested that i would be better to split the library :(

If no body is agains I will move Boost.Stopwatches to the namespace
boost::chrono, remove the reporting facilities, and find a date for a


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