Boost logo

Boost Users :

Subject: [Boost-users] Boost timer library : formatting a cpu_times value always prints zeros ?
From: Jean-Francois Romang (jeanfrancois.romang_at_[hidden])
Date: 2012-02-12 11:00:15


Hello,
I'm trying to use the boost::timer library, but I can't get to
'format' function to work : it always prints zero values.
I followed the documentation :
http://www.boost.org/doc/libs/1_48_0/libs/timer/doc/cpu_timers.html#Default-format
Here is my code :
{
            boost::timer::cpu_timer cput;
            someFunctionTakingTime();
            std::cout<<cput.elapsed().user/1000000000.0<<std::endl;
            std::cout<<cput.format(3,"%ws\n")<<std::endl;
}

Here is the result I get :
0.390002
0.000s

Using auto_cpu_timer does not help. Is there something wring in my code ?


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