Boost logo

Boost :

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


Libor Bus wrote:
>
> Hello,
> has anybody experienced also compatibility problems of chrono library on
> Android? I found following (Android 2.2, NDK-r5b, chrono v0.71, rev
> #71693):
>
> 1) Sources with boost::chrono::thread_clock does not compile, since
> _POSIX_THREAD_CPUTIME is not defined on Android. My workaround is to hack
> chrono/config.hpp:
> # if 1 //defined(_POSIX_THREAD_CPUTIME)
> # define BOOST_CHRONO_HAS_THREAD_CLOCK
> # define BOOST_CHRONO_THREAD_CLOCK_IS_MONOTONIC true
> # endif
>

I don't know Android. Do you know which is the macros used by Boost to
identify Android? Or some macro that is always defined when compiling on
Android?

It will be better to use this macro instead of commenting the condition.

> 2) ::clock_gettime() fails when called with clock ID got from
> pthread_getcpuclockid. My workaround is to call ::clock_gettime(
> CLOCK_THREAD_CPUTIME_ID, &ts ) in
> chrono/detail/inlined/posix/thread_clock.hpp.
>

Again I will need a specific macro to include this specific code.

> 3) Additionally there is precision problem on Linux platforms,
> stopwatch<process_cpu_clock> provides results with different units on
> Windows (nanoseconds) and Linux platforms (miliseconds).
>
>

I don't remember why there were different, but what is wrong on providing
the best precession provided by the platform?

Please, could you create a ticket on Trac, so we don't forget.
Thanks for the report, I will try to correct it as soon I have a macro to
make the difference.

Best,
Vicente

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