| Index: runtime/vm/os_linux.cc
|
| diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_linux.cc
|
| index 7924be1cfcd7460c55309f25096ddd8021c0ecc7..244e9b72e10985e9b9871dd30a2e190d7dd08bc6 100644
|
| --- a/runtime/vm/os_linux.cc
|
| +++ b/runtime/vm/os_linux.cc
|
| @@ -396,20 +396,32 @@ int64_t OS::GetCurrentTimeMicros() {
|
| }
|
|
|
|
|
| -int64_t OS::GetCurrentMonotonicMicros() {
|
| +int64_t OS::GetCurrentMonotonicTicks() {
|
| struct timespec ts;
|
| if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
| UNREACHABLE();
|
| return 0;
|
| }
|
| - // Convert to microseconds.
|
| + // Convert to nanoseconds.
|
| int64_t result = ts.tv_sec;
|
| - result *= kMicrosecondsPerSecond;
|
| - result += (ts.tv_nsec / kNanosecondsPerMicrosecond);
|
| + result *= kNanosecondsPerSecond;
|
| + result += ts.tv_nsec;
|
| return result;
|
| }
|
|
|
|
|
| +int64_t OS::GetCurrentMonotonicFrequency() {
|
| + return kNanosecondsPerSecond;
|
| +}
|
| +
|
| +
|
| +int64_t OS::GetCurrentMonotonicMicros() {
|
| + int64_t ticks = GetCurrentMonotonicTicks();
|
| + ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond);
|
| + return ticks / kNanosecondsPerMicrosecond;
|
| +}
|
| +
|
| +
|
| void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
|
| const int kMinimumAlignment = 16;
|
| ASSERT(Utils::IsPowerOfTwo(alignment));
|
|
|