
Howard Hinnant wrote:
On Apr 14, 2010, at 12:46 PM, Roland Bock wrote:
Hi,
forgive me for asking the obvious, but I fail to see how to get timing information from the thread_clock?
I can call thread_clock::now() to get time_point objects, e.g.
boost::chrono::thread_clock threadClock;
boost::chrono::thread_clock::time_point start = threadClock.now(); [...] boost::chrono::thread_clock::time_point end = threadClock.now();
But how do I get to the actual CPU milliseconds (or other units?) used by the current thread between end and start?
You can use boost::duration_cast to convert the thread_clock::duration into whatever units you desire. This facility will round down (truncate) if an exact conversion is not possible. Ex:
[snip] Great! Thanks for all the details! Regards, Roland