Interaction between boost::timer and boost::thread
Hi, I've decided to use boost::thread to run a background thread in my MPI application. Only one rank has a timer, and I only make some calls to elapsed(). Here is what I get if I print the values I retrieve from this single rank: 2.98 (...) 6.58 6.6 6.6 6.61 6.71 6.73 6.75 2.69 2.69 6.78 2.77 2.77 2.83 6.91 2.87 2.87 6.94 6.96 6.97 2.91 2.91 2.91 2.94 7.02 2.99 3.01 3.01 3.02 3.05 3.05 (...) You may notice that the values are not incresing, which leads to very bad total time in my case. Is there a known interaction between these two classes? I'm trying to create a simple example, but I can't get boost::timer to count sleep() time :| Matthieu Brucher -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher
2010/9/8 Matthieu Brucher
Is there a known interaction between these two classes? I'm trying to create a simple example, but I can't get boost::timer to count sleep() time :|
Timer uses clock() internally, which counts only CPU time on Linux and total time on Windows. Given non-portable nature of Boost.Timer, I would not recommend using it. Roman Perepelitsa.
2010/9/8 Roman Perepelitsa
2010/9/8 Matthieu Brucher
Is there a known interaction between these two classes? I'm trying to create a simple example, but I can't get boost::timer to count sleep() time :|
Timer uses clock() internally, which counts only CPU time on Linux and total time on Windows. Given non-portable nature of Boost.Timer, I would not recommend using it. Roman Perepelitsa.
It's strange that it is available in Boost without this kind of warning! Is there a portable and reliable timer in Boost ? Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher
Timer uses clock() internally, which counts only CPU time on Linux and
total
time on Windows. Given non-portable nature of Boost.Timer, I would not recommend using it.
It's strange that it is available in Boost without this kind of warning! Is there a portable and reliable timer in Boost ?
You could give the timer in boost::asio a shot, so to speak. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
2010/9/8 Raymond Burkholder
Timer uses clock() internally, which counts only CPU time on Linux and
total
time on Windows. Given non-portable nature of Boost.Timer, I would not recommend using it.
It's strange that it is available in Boost without this kind of warning! Is there a portable and reliable timer in Boost ?
You could give the timer in boost::asio a shot, so to speak.
To get the elapsed time, perhaps I may rely on boost::datetime? Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher
----- Original Message -----
From: "Matthieu Brucher"
2010/9/8 Roman Perepelitsa
: 2010/9/8 Matthieu Brucher
Is there a known interaction between these two classes? I'm trying to create a simple example, but I can't get boost::timer to count sleep() time :|
Timer uses clock() internally, which counts only CPU time on Linux and total time on Windows. Given non-portable nature of Boost.Timer, I would not recommend using it. Roman Perepelitsa.
It's strange that it is available in Boost without this kind of warning! Is there a portable and reliable timer in Boost ?
You can take a look at Boost.Chrono, and Boost.Stopwatches which should be review soon. https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Chron... https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Stopw... best, Vicente
2010/9/8 vicente.botet
----- Original Message ----- From: "Matthieu Brucher"
To: Sent: Wednesday, September 08, 2010 5:48 PM Subject: Re: [Boost-users] Interaction between boost::timer and boost::thread 2010/9/8 Roman Perepelitsa
: 2010/9/8 Matthieu Brucher
Is there a known interaction between these two classes? I'm trying to create a simple example, but I can't get boost::timer to count sleep() time :|
Timer uses clock() internally, which counts only CPU time on Linux and total time on Windows. Given non-portable nature of Boost.Timer, I would not recommend using it. Roman Perepelitsa.
It's strange that it is available in Boost without this kind of warning! Is there a portable and reliable timer in Boost ?
You can take a look at Boost.Chrono, and Boost.Stopwatches which should be review soon.
https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Chron... https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Stopw...
Thanks for the links. I will watch them and if they make it to an official release, I'll check if they can fulfill my needs. I can't use them now in production code when they may not be supported in the future. Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher
2010/9/8 Eric J. Holtman
On 9/8/2010 11:48 AM, Matthieu Brucher wrote:
I can't use them now in production code when they may not be supported in the future.
No snark here.... serious question.... what guaranty do you have that *any* boost library will be supported in the future?
I think there is a better guaranty for an official Boost library than for an unofficial, only because people will use the former more than the latter, and so more people may need to fix them. I've seen that Chrono is in fact an implementation of C++0x, so it will be a good start once available in a release. Matthieu -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher
Matthieu Brucher wrote:
2010/9/8 Eric J. Holtman
: On 9/8/2010 11:48 AM, Matthieu Brucher wrote:
I can't use them now in production code when they may not be supported in the future.
No snark here.... serious question.... what guaranty do you have that *any* boost library will be supported in the future?
What guarentee do you have that ANYTHING will be supported in the future. Can you guarentee that your own code will be? Once you import the boost source into your project, it becomes yours to do with what you will - just like your own code. So the risk/commitment is on worse than it is for your own code. Of course, a boost library might well be supported in the future - which would save you tons of work if/when that happens. If at some point it were to not be supported any more, you'd be no worse off than you would be with your own code. So I can see no economic case for deciding not to use a boost library if it does what you need. Robert Ramey
----- Original Message -----
From: "Matthieu Brucher"
2010/9/8 vicente.botet
:
You can take a look at Boost.Chrono, and Boost.Stopwatches which should be review soon.
https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Chron... https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Stopw...
Thanks for the links. I will watch them and if they make it to an official release, I'll check if they can fulfill my needs. I can't use them now in production code when they may not be supported in the future.
If you want to help to have these libraries into Boost, it would be great if you can make a pre-review, waiting for the official review date (very soon). Best, Vicente
participants (6)
-
Eric J. Holtman
-
Matthieu Brucher
-
Raymond Burkholder
-
Robert Ramey
-
Roman Perepelitsa
-
vicente.botet