Boost logo

Boost Users :

Subject: Re: [Boost-users] [timer] eclapsed return zero
From: gmail (hechaos_at_[hidden])
Date: 2008-09-06 00:17:13


i got the where the problem was.thank you

06/09/08 02:43:37, Mike Marchywka <marchywka@hotmail.com>:



________________________________
> From: hechaos@gmail.com
> To: boost-users@lists.boost.org
> Date: Fri, 5 Sep 2008 19:15:07 +0800
> Subject: [Boost-users] [timer] eclapsed return zero
>
> Hello, I have used the timer class in my application. It works ok sometime but i think it dont work correctly.

I'm not sure how timer is supposed to work but a few general comments.
Other than the obvious, "your mileage may vary" ( it really could be that fast),
I'm not even sure the compiler has to execute the loop if you turn on optimizations
and don't mark count as volatile as the intermediate results are unobservable.
Since no one looks at the end, it really never even needs to push count.

I think that is legal anyway, opposing viewpoints welcome :)



> my code is:
> #include
> #include "boost/timer.hpp"
> using namespace std;
> using namespace boost;
> int main()
> {
> int count=0;
> timer t;
> for(;count cout< return 0;
> }
> and the output:
> 0.015
> execute time :0.062s
>
> sometime the output is:
> 0
> execute time :0.015s
>
> regards
> hechao

_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

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