1
0
mirror of https://github.com/google/benchmark.git synced 2025-02-18 15:20:13 +08:00

Fix compilation for Android ()

Android doesn't support `getloadavg`
This commit is contained in:
Michał Janiszewski 2019-05-10 00:22:13 +02:00 committed by Dominic Hamon
parent 33d4404650
commit b988639f31

View File

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