Hi, Do any of the boost timer methods allow elapsed time to be measured in a separate thread? Something like: int main() { boost_thread timer; timer.Start(); while () { // some timeout. sleep(5000); // check how much time has passed. cout << timer.GetElapsedTime() << endl; } return 0; } Thanks
On Tue, 06 Nov 2007 16:24:39 +0100, Mark Wyszomierski
Hi,
Do any of the boost timer methods allow elapsed time to be measured in a separate thread? Something like:
int main() { boost_thread timer; timer.Start();
while () { // some timeout. sleep(5000);
// check how much time has passed. cout << timer.GetElapsedTime() << endl; }
return 0; }
Thanks
boost::timer has that functionality, but as you probably don't want, it will give you effective cpu time usage, not real time passed. You could use boost::xtime_get(...) twice and compare the difference in time. See http://www.boost.org/doc/html/boost/xtime.html for more information. -- Jonas Hansson
Thanks Jonas, I'll check it out.
Mark
On 11/6/07, Jonas Hansson
On Tue, 06 Nov 2007 16:24:39 +0100, Mark Wyszomierski
wrote: Hi,
Do any of the boost timer methods allow elapsed time to be measured in a separate thread? Something like:
int main() { boost_thread timer; timer.Start();
while () { // some timeout. sleep(5000);
// check how much time has passed. cout << timer.GetElapsedTime() << endl; }
return 0; }
Thanks
boost::timer has that functionality, but as you probably don't want, it will give you effective cpu time usage, not real time passed. You could use boost::xtime_get(...) twice and compare the difference in time.
See http://www.boost.org/doc/html/boost/xtime.html for more information.
-- Jonas Hansson
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Jonas Hansson
-
Mark Wyszomierski