|
Boost : |
Subject: [boost] [chrono] Thread clock compatibility problems on Android
From: Libor Bus (libor.bus_at_[hidden])
Date: 2011-05-13 10:08:49
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
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.
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).
BR,
Libor
-- View this message in context: http://boost.2283326.n4.nabble.com/chrono-Thread-clock-compatibility-problems-on-Android-tp3520310p3520310.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