Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2005-02-11 17:41:16


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

> BTW, I'm wondering why you don't use something like this as the basis for
> your high-resolution timer:
>
> boost::posix_time::ptime get_highres_time()

One subtle difference is that the current implementation uses
CPU-cycle timings (via std::clock or Win32 QueryPerformanceCounter)
and not wall-clock timings. Using the xtime_get approach would give
you a wall-clock based timer which may not be what you want.

Christopher: a couple of comments on the current implementation of the
basic_profiler:

* std::map and std::string are used unqualified and w/o headers being included
* string arguments to methods should be passed by const ref
* There should be a public elapsed() method to extract the elapsed
time from a profiler. Perhaps it should just be public?
* basic_profiler::restart invokes logging_policy::on_restart which is
not implemented (should this be on_resume?)
* basic_profiler::restart, ::resume and ::pause all call methods on an
undefined object "timer". Should be "t".
* basic_profiler::pause calls (when fixed) t.pause which is not implemented.
* In the private section of basic_profiler, the typename in "typename
timer_t t" is (I think) spurious.
* The basic_profiler ctor initializes members in a different order
than they are declared in the class

Might I also suggest that the basic_profiler.stop method not zero out
the elapsed time. Leave it to restart to do that. Think of it like a
stop-watch.

-- 
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