Timer suspended during disk operations?

Hello everyone, I've been trying to use the boost/timer class to provide some information on the time taken by subtasks in my program. I have noticed that times seem to be reported fine as long as subtasks are doing CPU processing, but disk operations seem to suspend the timer. For instance buffering a bigger file to memory is reported to take eg. half a second, while it can clearly be seen that the program is running for 15 seconds. Any ideas on what can cause this behaviour and if there is any way to make it work properly? I am using g++ 3.4.4 with boost 1.33.1 under Win XP Pro SP2. Thanks in advance! --Przem

On Fri, 20 Apr 2007, Przemyslaw Tumidajewicz wrote:
I've been trying to use the boost/timer class to provide some information on the time taken by subtasks in my program. I have noticed that times seem to be reported fine as long as subtasks are doing CPU processing, but disk operations seem to suspend the timer. For instance buffering a bigger file to memory is reported to take eg. half a second, while it can clearly be seen that the program is running for 15 seconds. Any ideas on what can cause this behaviour and if there is any way to make it work properly? I am using g++ 3.4.4 with boost 1.33.1 under Win XP Pro SP2.
boost::timer uses std::clock to measure time, which measures only the time
a process spends using the CPU. What you want is to use a real time clock.
You can to that with the Boost.DateTime library.
Example: (using microseconds precision, untested)
#include

François Duranleau wrote:
On Fri, 20 Apr 2007, Przemyslaw Tumidajewicz wrote: boost::timer uses std::clock to measure time, which measures only the time a process spends using the CPU. What you want is to use a real time clock. You can to that with the Boost.DateTime library.
Example: (using microseconds precision, untested)
..snip...
There's actually a bunch of timer rewrites in the vault right now http://boost-consulting.com/vault/index.php?PHPSESSID=89ru43aab3t1dud9qpkjv7hu87&direction=0&order=&directory=date_time The one I know I've used is new_timer.zip 15.05.2006 which is based on date-time microsecond clock. Jeff

Thanks François and Jeff, exactly the info I needed. I'll have a look at the new_timer-s. --Przem
participants (3)
-
François Duranleau
-
Jeff Garland
-
Przemyslaw Tumidajewicz