| Index: runtime/bin/utils_macos.cc
|
| diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc
|
| index 5ac414fb9b5ca399e7970403e4ba28d415d68365..eea4cb750b077503736bc228d18a32d445e5163c 100644
|
| --- a/runtime/bin/utils_macos.cc
|
| +++ b/runtime/bin/utils_macos.cc
|
| @@ -13,6 +13,10 @@
|
| #include <sys/time.h> // NOLINT
|
| #include <time.h> // NOLINT
|
|
|
| +#if TARGET_OS_IOS
|
| +#include <sys/sysctl.h> // NOLINT
|
| +#endif
|
| +
|
| #include "bin/utils.h"
|
| #include "platform/assert.h"
|
| #include "platform/utils.h"
|
| @@ -85,6 +89,20 @@ int64_t TimerUtils::GetCurrentMonotonicMillis() {
|
| return GetCurrentMonotonicMicros() / 1000;
|
| }
|
|
|
| +#if TARGET_OS_IOS
|
| +
|
| +static int64_t GetCurrentTimeMicros() {
|
| + // gettimeofday has microsecond resolution.
|
| + struct timeval tv;
|
| + if (gettimeofday(&tv, NULL) < 0) {
|
| + UNREACHABLE();
|
| + return 0;
|
| + }
|
| + return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
|
| +}
|
| +
|
| +#endif // TARGET_OS_IOS
|
| +
|
| int64_t TimerUtils::GetCurrentMonotonicMicros() {
|
| #if TARGET_OS_IOS
|
| // On iOS mach_absolute_time stops while the device is sleeping. Instead use
|
|
|