1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-29 22:40:33 +08:00

sysinfo.cc: Call getloadavg for Android API >= 29 ()

Support for `getloadavg` was added in API level 29.
This commit is contained in:
Jesse Rosenstock 2023-08-14 16:38:42 +02:00 committed by GitHub
parent 1c64a36c5b
commit 271d97a10b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -817,7 +817,7 @@ std::vector<double> GetLoadAvg() {
#if (defined BENCHMARK_OS_FREEBSD || defined(BENCHMARK_OS_LINUX) || \
defined BENCHMARK_OS_MACOSX || defined BENCHMARK_OS_NETBSD || \
defined BENCHMARK_OS_OPENBSD || defined BENCHMARK_OS_DRAGONFLY) && \
!defined(__ANDROID__)
!(defined(__ANDROID__) && __ANDROID_API__ < 29)
static constexpr int kMaxSamples = 3;
std::vector<double> res(kMaxSamples, 0.0);
const int nelem = getloadavg(res.data(), kMaxSamples);