Index: runtime/vm/os_linux.cc |
diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_linux.cc |
index 0fc90c7394abdcfec135ba8152c6178edbdc0be9..7d7c7e0fc5d580f5321c9a4d199d6067dcd36fc1 100644 |
--- a/runtime/vm/os_linux.cc |
+++ b/runtime/vm/os_linux.cc |
@@ -175,6 +175,19 @@ int64_t OS::GetCurrentMonotonicMicros() { |
} |
+int64_t OS::GetCurrentThreadCPUMicros() { |
+ struct timespec ts; |
+ if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) { |
+ UNREACHABLE(); |
+ return -1; |
+ } |
+ int64_t result = ts.tv_sec; |
+ result *= kMicrosecondsPerSecond; |
+ result += (ts.tv_nsec / kNanosecondsPerMicrosecond); |
+ return result; |
+} |
+ |
+ |
void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) { |
const int kMinimumAlignment = 16; |
ASSERT(Utils::IsPowerOfTwo(alignment)); |