Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2005-02-11 22:07:01


On Fri, 11 Feb 2005 18:05:34 -0500, Preston A. Elder
<prez_at_[hidden]> wrote:

> I thought boost::timer (which the high_res_timer is modelled on) used wall
> clock values though. This makes sense, because if you're using the timer
> to say "X task to Y seconds", you hardly want to tell them how much CPU
> time it spent on it. It would look odd to use a timer that told the user
> X task took 20 seconds, when its been over a minute, it just got 20s CPU
> time.

No, boost::timer uses std::clock, which measures CPU cycles. For example:

#include <boost/progress.hpp>
#include <cstdlib>
int main () { boost::progress_timer t; sleep (10); }

Outputs "0.00 s" on my machine.

> This is basically something that needs to be decided, though I suppose
> policies could take care of it (wall_clock or cpu_time for accumulation),
> but do you want to profile how long it took something to run, or how much
> time was spent doing it? As you say, they're subtly different things.

I agree that this should be user-selectable (and it is in
Christopher's implementation). Having those two user-friendly timer
names as you suggest is a good idea.

-- 
Caleb Epstein
caleb dot epstein at gmail dot com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk