Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-03-03 21:33:11


(sorry - mail client weirdness on the last post- I have fixed the
doublespacing)(here is the mail again)

*********************************************

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)

 

 


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