Chip Davis : ntdll: Implement idle time query for Mac OS.
Alexandre Julliard
julliard at winehq.org
Thu May 19 16:15:13 CDT 2022
Module: wine
Branch: master
Commit: f3d9f00850926b01b0f28e40d3fa0b48028eed4f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f3d9f00850926b01b0f28e40d3fa0b48028eed4f
Author: Chip Davis <cdavis5x at gmail.com>
Date: Sun May 8 16:41:49 2022 -0500
ntdll: Implement idle time query for Mac OS.
Signed-off-by: Chip Davis <cdavis5x at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/system.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 4d5fc282e45..ee91441794e 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -1848,6 +1848,22 @@ static void get_performance_info( SYSTEM_PERFORMANCE_INFORMATION *info )
info->IdleTime.QuadPart = (ULONGLONG)ptimes[CP_IDLE] * 10000000 / clockrate.stathz;
}
}
+#elif defined(__APPLE__)
+ {
+ host_name_port_t host = mach_host_self();
+ struct host_cpu_load_info load_info;
+ mach_msg_type_number_t count;
+
+ count = HOST_CPU_LOAD_INFO_COUNT;
+ if (host_statistics(host, HOST_CPU_LOAD_INFO, (host_info_t)&load_info, &count) == KERN_SUCCESS)
+ {
+ /* Believe it or not, based on my reading of XNU source, this is
+ * already in the units we want (100 ns).
+ */
+ info->IdleTime.QuadPart = load_info.cpu_ticks[CPU_STATE_IDLE];
+ }
+ mach_port_deallocate(mach_task_self(), host);
+ }
#else
{
static ULONGLONG idle;
More information about the wine-cvs
mailing list