<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff --git Source/WTF/wtf/unix/CPUTimeUnix.cpp Source/WTF/wtf/unix/CPUTimeUnix.cpp
index 27990893..fe279865 100644
--- Source/WTF/wtf/unix/CPUTimeUnix.cpp
+++ Source/WTF/wtf/unix/CPUTimeUnix.cpp
@@ -26,6 +26,68 @@
 #include "config.h"
 #include "CPUTime.h"
 
+#if OS(DARWIN)
+#import &lt;mach/mach.h&gt;
+#import &lt;mach/mach_time.h&gt;
+#import &lt;mach/task.h&gt;
+#import &lt;mach/task_info.h&gt;
+#import &lt;mach/thread_info.h&gt;
+#import &lt;sys/time.h&gt;
+
+#include &lt;wtf/Optional.h&gt;
+
+namespace WTF {
+
+static const int64_t microsecondsPerSecond = 1000000;
+
+static int64_t timeValueToMicroseconds(const time_value_t&amp; value)
+{
+    int64_t result = value.seconds;
+    result *= microsecondsPerSecond;
+    result += value.microseconds;
+    return result;
+}
+
+Optional&lt;CPUTime&gt; CPUTime::get()
+{
+    // Account for current threads.
+    task_thread_times_info threadInfoData;
+    mach_msg_type_number_t threadInfoCount = TASK_THREAD_TIMES_INFO_COUNT;
+    kern_return_t result = task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, reinterpret_cast&lt;task_info_t&gt;(&amp;threadInfoData), &amp;threadInfoCount);
+    if (result != KERN_SUCCESS)
+        return nullopt;
+
+    int64_t userTime = timeValueToMicroseconds(threadInfoData.user_time);
+    int64_t systemTime = timeValueToMicroseconds(threadInfoData.system_time);
+
+    // Account for termined threads.
+    task_basic_info taskInfoData;
+    mach_msg_type_number_t taskInfoCount = TASK_BASIC_INFO_COUNT;
+    result = task_info(mach_task_self(), TASK_BASIC_INFO, reinterpret_cast&lt;task_info_t&gt;(&amp;taskInfoData), &amp;taskInfoCount);
+    if (result != KERN_SUCCESS)
+        return nullopt;
+
+    userTime += timeValueToMicroseconds(taskInfoData.user_time);
+    systemTime += timeValueToMicroseconds(taskInfoData.system_time);
+
+    return CPUTime { MonotonicTime::now(), Seconds::fromMicroseconds(userTime), Seconds::fromMicroseconds(systemTime) };
+}
+
+Seconds CPUTime::forCurrentThread()
+{
+    mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT;
+    thread_basic_info_data_t info;
+
+    mach_port_t threadPort = mach_thread_self();
+    thread_info(threadPort, THREAD_BASIC_INFO, reinterpret_cast&lt;thread_info_t&gt;(&amp;info), &amp;infoCount);
+    mach_port_deallocate(mach_task_self(), threadPort);
+
+    return Seconds(info.user_time.seconds + info.system_time.seconds) + Seconds::fromMicroseconds(info.user_time.microseconds + info.system_time.microseconds);
+}
+
+}
+#else //OS(DARWIN)
+
 #include &lt;sys/resource.h&gt;
 #include &lt;sys/time.h&gt;
 #include &lt;time.h&gt;
@@ -54,3 +114,4 @@ Seconds CPUTime::forCurrentThread()
 }
 
 }
+#endif //OS(DARWIN)
\ No newline at end of file
</pre></body></html>