Boost logo

Boost :

From: Silex (silex0r_at_[hidden])
Date: 2006-05-14 11:09:28


Hello,

Currently there's boost::timer which is a timer based on std::clock().
While this might be sufficient for many people, some want low-level
resolution timers.

I made a QueryPerformanceCounter() / gettimeofday() wrapper that
allows portable millisecond resolution.

You'll find attached a basic sample of my trivial work. I tried to
make it so inclusion in boost is straight-forward.

To see it in action :

-Copy the precise_timer* hpp files into the boost directory.
-Compile main.cpp & execute it.

Would boost be interested by including this class in boost::timer ?
I'm all ear for your suggestions / bugs / whatever fits it :)
This is the 1st time I propose something to boost so there's probably
things to be said on the implementation details (files structure,
#ifdef strategy etc) so don't hesitate to tell what should be changed.

I also can make that if on windows QueryPerformanceCounter() fails
because there's no low-level resolution timer available it uses
timeGetTime() instead. But that'd require linking to winmm.lib which
could be a problem ( and I never saw a win32 machine where
QueryPerformanceCounter() didn't work ).

I just thought that I could also rename it to lowres_timer instead of
precise_timer, it's more accurate, what do you think ?

Regards,
Philippe Vaucher




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