Boost logo

Boost :

Subject: Re: [boost] [chrono] Thread clock compatibility problems on Android
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-13 14:43:37


Libor Bus wrote:
>
> Hello Vicente,
> thanks for the fast answer and your great library!
>
> You can rely on #if defined ANDROID.
>
Thanks.

> 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?

> I was not even able to convert units:
> {
> stopwatch<process_cpu_clock>::duration d = t.stop();
> real_time = microseconds( d.count().real).count(); // needs to be
> multiplied by 1000
> }
> I'm not sure if I'm using conversion right way, but at least the stopclock
> text output indicates some problem.
>

Note that you could use the process_real_cpu_clock directly. Using
process_cpu_clock you need to get the associated
process_real_cpu_clock::duration in order to make the conversion.
I think that what you wanted should be

   real_time = microseconds(
process_real_cpu_clock::duration(d.count().real)).count();

but maybe I have misunderstood your purpose.

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/chrono-Thread-clock-compatibility-problems-on-Android-tp3520310p3520894.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