Boost logo

Boost :

Subject: Re: [boost] [chrono] Thread clock compatibility problems on Android
From: Libor Bus (libor.bus_at_[hidden])
Date: 2011-05-14 12:04:58


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.
BR,
Libor

--
View this message in context: http://boost.2283326.n4.nabble.com/chrono-Thread-clock-compatibility-problems-on-Android-tp3520310p3522582.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk