[timer] Comments do not match the implementation?
I would like to use boost::timer to replace a timing object from another library. In looking into the header file, I noticed the following comments: // It is recommended that implementations measure wall clock rather than CPU // time since the intended use is performance measurement on systems where // total elapsed time is more important than just process or CPU time. All is well and good I thought to myself ... wall clock is exactly what I want! But alas, the implementation just wraps std::clock(). The man page for clock states the following: "The clock() function returns an approximation of processor time used by the program." In summary, the header states that the timer implementation should use wall clock time, but it ignores its own advice and uses processor time. I'm confused. Do I need to create my own timer implementation in order to use wall clock time? Thanks, Justin
KSpam wrote:
I would like to use boost::timer to replace a timing object from another library. In looking into the header file, I noticed the following comments:
// It is recommended that implementations measure wall clock rather than CPU // time since the intended use is performance measurement on systems where // total elapsed time is more important than just process or CPU time.
All is well and good I thought to myself ... wall clock is exactly what I want! But alas, the implementation just wraps std::clock(). The man page for clock states the following:
"The clock() function returns an approximation of processor time used by the program."
In summary, the header states that the timer implementation should use wall clock time, but it ignores its own advice and uses processor time. I'm confused. Do I need to create my own timer implementation in order to use wall clock time?
No, there's a couple of date-time based timers floating around that measure wall clock time. You can find the most recent incarnation in the super_string (version 2) download in the vault http://boost-consulting.com/vault/index.php?&direction=0&order=&directory=Strings%20-%20Text%20Processing The code is in test/date_time_timer.hpp and you'll find some example usage in test/performance.cpp. Usage should be pretty obvious. The long running goal has been to replace the current timer with something like the one above...it just hasn't been high enough on the priority list to get done yet. Jeff
On Sunday 17 September 2006 11:27, Jeff Garland wrote:
No, there's a couple of date-time based timers floating around that measure wall clock time. You can find the most recent incarnation in the super_string (version 2) download in the vault
http://boost-consulting.com/vault/index.php?&direction=0&order=&directory=S trings%20-%20Text%20Processing
The code is in test/date_time_timer.hpp and you'll find some example usage in test/performance.cpp. Usage should be pretty obvious.
The long running goal has been to replace the current timer with something like the one above...it just hasn't been high enough on the priority list to get done yet.
Jeff
Thanks! Looking at the vault super_string library would probably be the last place I would look for a timer class, but it looks as if this is exactly what I need. This will fill the gap until the longer-term goals are achieved. Justin
participants (2)
-
Jeff Garland
-
KSpam