Commit 6ecf8a8e by Ian McKellar Committed by Eric

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
parent 207b9c7a
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
#include "internal_macros.h" #include "internal_macros.h"
#ifndef BENCHMARK_OS_WINDOWS #ifndef BENCHMARK_OS_WINDOWS
#ifndef BENCHMARK_OS_FUCHSIA
#include <sys/resource.h> #include <sys/resource.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
......
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
#include "internal_macros.h" #include "internal_macros.h"
#ifndef BENCHMARK_OS_WINDOWS #ifndef BENCHMARK_OS_WINDOWS
#ifndef BENCHMARK_OS_FUCHSIA
#include <sys/resource.h> #include <sys/resource.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#define BENCHMARK_OS_EMSCRIPTEN 1 #define BENCHMARK_OS_EMSCRIPTEN 1
#elif defined(__rtems__) #elif defined(__rtems__)
#define BENCHMARK_OS_RTEMS 1 #define BENCHMARK_OS_RTEMS 1
#elif defined(__Fuchsia__)
#define BENCHMARK_OS_FUCHSIA 1
#endif #endif
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \ #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
......
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
#include <Windows.h> #include <Windows.h>
#else #else
#include <fcntl.h> #include <fcntl.h>
#ifndef BENCHMARK_OS_FUCHSIA
#include <sys/resource.h> #include <sys/resource.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD #include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
#include <unistd.h> #include <unistd.h>
......
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
#include <Windows.h> #include <Windows.h>
#else #else
#include <fcntl.h> #include <fcntl.h>
#ifndef BENCHMARK_OS_FUCHSIA
#include <sys/resource.h> #include <sys/resource.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD #include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
#include <unistd.h> #include <unistd.h>
...@@ -74,7 +76,7 @@ double MakeTime(FILETIME const& kernel_time, FILETIME const& user_time) { ...@@ -74,7 +76,7 @@ double MakeTime(FILETIME const& kernel_time, FILETIME const& user_time) {
static_cast<double>(user.QuadPart)) * static_cast<double>(user.QuadPart)) *
1e-7; 1e-7;
} }
#else #elif !defined(BENCHMARK_OS_FUCHSIA)
double MakeTime(struct rusage const& ru) { double MakeTime(struct rusage const& ru) {
return (static_cast<double>(ru.ru_utime.tv_sec) + return (static_cast<double>(ru.ru_utime.tv_sec) +
static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 + static_cast<double>(ru.ru_utime.tv_usec) * 1e-6 +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment