mirror of
https://github.com/google/benchmark.git
synced 2024-11-26 07:32:19 +00:00
Don't include <sys/resource.h> on Fuchsia. (#531)
* Don't include <sys/resource.h> on Fuchsia. It doesn't support POSIX resource measurement and timing APIs. Change-Id: Ifab4bac4296575f042c699db1ce5a4f7c2d82893 * Add BENCHMARK_OS_FUCHSIA for Fuchsia Change-Id: Ic536f9625e413270285fbfd08471dcb6753ddad1
This commit is contained in:
parent
207b9c7aec
commit
6ecf8a8e80
|
@ -17,7 +17,9 @@
|
|||
#include "internal_macros.h"
|
||||
|
||||
#ifndef BENCHMARK_OS_WINDOWS
|
||||
#ifndef BENCHMARK_OS_FUCHSIA
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
#include "internal_macros.h"
|
||||
|
||||
#ifndef BENCHMARK_OS_WINDOWS
|
||||
#ifndef BENCHMARK_OS_FUCHSIA
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#define BENCHMARK_OS_EMSCRIPTEN 1
|
||||
#elif defined(__rtems__)
|
||||
#define BENCHMARK_OS_RTEMS 1
|
||||
#elif defined(__Fuchsia__)
|
||||
#define BENCHMARK_OS_FUCHSIA 1
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
#include <Windows.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#ifndef BENCHMARK_OS_FUCHSIA
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
#include <Windows.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#ifndef BENCHMARK_OS_FUCHSIA
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
|
||||
#include <unistd.h>
|
||||
|
@ -74,7 +76,7 @@ double MakeTime(FILETIME const& kernel_time, FILETIME const& user_time) {
|
|||
static_cast<double>(user.QuadPart)) *
|
||||
1e-7;
|
||||
}
|
||||
#else
|
||||
#elif !defined(BENCHMARK_OS_FUCHSIA)
|
||||
double MakeTime(struct rusage const& ru) {
|
||||
return (static_cast<double>(ru.ru_utime.tv_sec) +
|
||||
static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 +
|
||||
|
|
Loading…
Reference in a new issue