|
Boost Users : |
From: __PPS__ (i-love-spam_at_[hidden])
Date: 2005-11-19 22:12:30
I got strange results with boost::progress_timer - it shows timings like
1.45s whereas it took about 15 sec. to complete a routine.
It used to work ok, but I have no idea why it just doesn't work anymore!
I use freebsd 4.11 and clocks_per_sec is defined 128.
sysconf(_SC_CLK_TCK) also returns 128, but clock counter is not correct
completely.
I wrote simple test class, to see what's wrong:
struct Timer {
clock_t t;
time_t tt;
Timer() : t(clock()), tt(time(0)){}
~Timer(){
std::cout <<
"Elapsed interval: " <<
(static_cast<double>(clock() -t))/CLOCKS_PER_SEC <<
"s " << (time(0)-tt) << "s\n" ;
}
};
this is the output:
Elapsed interval: 1.52344s 33s
1.52 s <- output by boost::progress_timer.
so, you may see that measured time is completely wrong. I rewrote it
with microtime(...) and it works correctly now.
any ideas what's wrong, why clock() doesn't work anymore? Wouldn't that
be a good idea to use microtime for unices?
thanks
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net