We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ada0ad2 commit 3d8290dCopy full SHA for 3d8290d
runtime/vm/os_macos.cc
@@ -106,6 +106,12 @@ int64_t OS::GetCurrentMonotonicMicros() {
106
}
107
108
int64_t OS::GetCurrentThreadCPUMicros() {
109
+ if (__builtin_available(macOS 10.12, iOS 10.0, *)) {
110
+ // This is more efficient when available.
111
+ return clock_gettime_nsec_np(CLOCK_THREAD_CPUTIME_ID) /
112
+ kNanosecondsPerMicrosecond;
113
+ }
114
+
115
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
116
thread_basic_info_data_t info_data;
117
thread_basic_info_t info = &info_data;
0 commit comments