
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