|
Boost : |
From: Hartmut Kaiser (hartmutkaiser_at_[hidden])
Date: 2005-02-05 11:11:28
christopher diggins wrote:
> > I have a boost::timer interface compatible high resolution
> timer here,
> > which
> > I can submit, if anybody is interested.
> >
> > Regards Hartmut
>
> I am most definitely interested, and I am quite sure the
> others who have
> already expressed interest in the profiler library would be
> as well. Would
> it be appropriate as the default polciy timer for the
> library, or would it
> be more appropriate as part of the examples? How high is the
> resolution, and
> what platforms does it work on?
Works currently on Windows only, but could be easily extended to work on
Posix systems as well (using the Posix high resolution timers). The
resolution is platform dependent because it currently uses the Windows
high-resolution performance counters, which are based on the cycle rate of
the processor clock. The attached implementation simply falls back to
boost::timer when used on non-system platforms.
> A general question w.r.t platform dependencies, what is the
> standard way to
> proceed when authouring a boost library which varies on the
> platform? For
> instance is the following acceptable for Boost:
>
> #ifdef BOOST_WINDOWS
> typdef win32_profiler_policy default_profiler_policy;
> #elif BOOST_POSIX
> typdef posix_profiler_policy default_profiler_policy;
> #else
> typdef boost_default_profiler_policy default_profiler_policy;
> #endif
Sure, why not? Maybe you want have a look at the Boost.Threads library,
which uses a similar technique internally.
Regards Hartmut
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk