high_resolution_timer \ timer feature requests for Boost.Timer

First off- note that Timer can take a start time on the ctor: class timer { public: timer() { _start_time = std::clock(); } // postcondition: elapsed()==0 (snip) high_resolution_timer does not however: class high_resolution_timer { public: // ctor high_resolution_timer() { start_time.QuadPart = 0; frequency.QuadPart = 0; if (!QueryPerformanceFrequency(&frequency)) throw std::runtime_error("Couldn't acquire frequency"); restart(); } (snip) MY PROBLEM: I need to feed the timer the START time (or get FROM it the start time would be preferred) The reason I need this is because for logging purposes (working with the Profiler from Christopher Diggins) I need to log the start and stop times, and I need it to (for internal cross reference) be the same number for multiple purposes. MY REQUESTS: Easy request: high_resolution_timer is changed to have the same type of ctor as timer does May Start a discussion request: That something like a starttime() method is provided for both classes Medium request- That both classes do a typedef for the type returned by the starttime method i.e. instead of class high_resolution_timer { public: (snip) private: timer t; // backup in case of QueryPerformanceCounter() bug LARGE_INTEGER start_time; LARGE_INTEGER frequency; }; You have instead: class high_resolution_timer { public: (snip) typedef LARGE_INTEGER TIME_TYPE; private: timer t; // backup in case of QueryPerformanceCounter() bug TIME_TYPE start_time; TIME_TYPE frequency; }; (for both high_resolution_timer and timer) There you go, those are my requests. Now I will sit here quietly and hope there is a Santa Claus.... (grin)

How do you intent to deal with nested timers (outer ones might become very inaccurate because of the inner ones)? Also, how do you plan to represent results of such profiling?

"Brian Braatz" <brianb@rmtg.com> writes:
First off- note that Timer can take a start time on the ctor:
class timer
{
public:
timer() { _start_time = std::clock(); } // postcondition: elapsed()==0
(snip)
high_resolution_timer does not however:
class high_resolution_timer
{
public:
// ctor
Brian, did you realize your mailer was inserting double newlines in your code examples? -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
Brian Braatz
-
David Abrahams
-
Goran Mitrovic