
Libor Bus wrote:
Vicente Botet wrote:
Regarding process_cpu_clock, I have experienced that following code provided on Linux wrong text output, while on Windows was ok: { boost::stopwatches::stopclock<> timer; ... some work }
Could you give me output on both cases?
Consider following code snippet: { boost::stopwatches::stopclock<> boost_timer; for( int i = 0; i < 10000000; i++) sqrt( 123.456L); sleep( 1); // sleep 1s }
Text output on windows is: real 1.031s, cpu 0.031s (3.0%), user 0.031s, system 0.000s while thread clock measures: wall=1031ms, cpu=31ms
Text output on Android (on Linux was similar) is: real 0.001s, cpu 0.000s (23.2%), user 0.000s, system 0.000s while thread clock measures: wall=1377ms, cpu=312ms
Test on Android was around 10x slower because I run it on Android emulator (can not test Linux right now). Behaviour on Linux I saw couple of days ago was same as on Android, i.e., stopclock provided wrong text output, just test was similar fast as on Windows.
Hope this helps.
On which linux dis you tried? It seems that the posix process_cpu_clocks is not working on this platform. This clock uses tms tm; clock_t c = ::times( &tm ); Could you dump the values of c and tm.tms_stime + tm.tms_cstime, tm.tms_utime + tm.tms_cutime, before and after the sleep? Thanks, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/chrono-Thread-clock-compatibility-problem... Sent from the Boost - Dev mailing list archive at Nabble.com.