authorgravatar for devnexen@gmail.comDavid Carlier <devnexen@gmail.com> 2023-05-11 23:16:49+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-05-12 20:20:31+03:00
log6547d233125199b16644c0f7504793490af67926
treec2b04edfa84c759c97ef10a0ddca2b00eca1a61d
parent3062f9b02a4757fc2a39e50e62f4c65e6096130f

std.c: adding basic darwin's host_statistics data.


1 files changed, 56 insertions(+), 0 deletions(-)

lib/std/c/darwin.zig+56
...@@ -3996,6 +3996,9 @@ pub const HOST = struct {...@@ -3996,6 +3996,9 @@ pub const HOST = struct {
3996 pub const DEBUG_INFO_INTERNAL = 10;3996 pub const DEBUG_INFO_INTERNAL = 10;
3997 pub const CAN_HAS_DEBUGGER = 11;3997 pub const CAN_HAS_DEBUGGER = 11;
3998 pub const PREFERRED_USER_ARCH = 12;3998 pub const PREFERRED_USER_ARCH = 12;
3999 pub const LOAD_INFO = 1;
4000 pub const VM_INFO = 2;
4001 pub const CPU_LOAD_INFO = 3;
3999 pub const CAN_HAS_DEBUGGER_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_can_has_debugger_info_data_t) / @sizeOf(integer_t));4002 pub const CAN_HAS_DEBUGGER_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_can_has_debugger_info_data_t) / @sizeOf(integer_t));
4000 pub const SCHED_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_sched_info_data_t) / @sizeOf(integer_t));4003 pub const SCHED_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_sched_info_data_t) / @sizeOf(integer_t));
4001 pub const RESOURCES_SIZES_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(kernel_resource_sizes_data_t) / @sizeOf(integer_t));4004 pub const RESOURCES_SIZES_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(kernel_resource_sizes_data_t) / @sizeOf(integer_t));
...@@ -4003,6 +4006,7 @@ pub const HOST = struct {...@@ -4003,6 +4006,7 @@ pub const HOST = struct {
4003 pub const CPU_LOAD_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_cpu_load_info_data_t) / @sizeOf(integer_t));4006 pub const CPU_LOAD_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_cpu_load_info_data_t) / @sizeOf(integer_t));
4004 pub const LOAD_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_load_info_data_t) / @sizeOf(integer_t));4007 pub const LOAD_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_load_info_data_t) / @sizeOf(integer_t));
4005 pub const PREFERRED_USER_ARCH_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_preferred_user_arch_data_t) / @sizeOf(integer_t));4008 pub const PREFERRED_USER_ARCH_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(host_preferred_user_arch_data_t) / @sizeOf(integer_t));
4009 pub const VM_INFO_COUNT = @intCast(mach_msg_type_number_t, @sizeOf(vm_statistics_data_t) / @sizeOf(integer_t));
4006};4010};
40074011
4008pub const host_basic_info = packed struct(u32) {4012pub const host_basic_info = packed struct(u32) {
...@@ -4020,3 +4024,55 @@ pub const host_basic_info = packed struct(u32) {...@@ -4020,3 +4024,55 @@ pub const host_basic_info = packed struct(u32) {
4020};4024};
40214025
4022pub extern "c" fn host_info(host: host_t, flavor: host_flavor_t, info_out: host_info_t, info_outCnt: [*]mach_msg_type_number_t) kern_return_t;4026pub extern "c" fn host_info(host: host_t, flavor: host_flavor_t, info_out: host_info_t, info_outCnt: [*]mach_msg_type_number_t) kern_return_t;
4027pub extern "c" fn host_statistics(priv: host_t, flavor: host_flavor_t, info_out: host_info_t, info_outCnt: [*]mach_msg_type_number_t) kern_return_t;
4028
4029pub const vm_statistics = extern struct {
4030 free_count: natural_t,
4031 active_count: natural_t,
4032 inactive_count: natural_t,
4033 wire_count: natural_t,
4034 zero_fill_count: natural_t,
4035 reactivations: natural_t,
4036 pageins: natural_t,
4037 pageouts: natural_t,
4038 faults: natural_t,
4039 cow_faults: natural_t,
4040 lookups: natural_t,
4041 hits: natural_t,
4042 purgeable_count: natural_t,
4043 purges: natural_t,
4044 speculative_count: natural_t,
4045};
4046
4047pub const vm_statistics_t = *vm_statistics;
4048pub const vm_statistics_data_t = vm_statistics;
4049
4050pub const vm_statistics64 align(8) = extern struct {
4051 free_count: natural_t,
4052 active_count: natural_t,
4053 inactive_count: natural_t,
4054 wire_count: natural_t,
4055 zero_fill_count: u64,
4056 reactivations: u64,
4057 pageins: u64,
4058 pageouts: u64,
4059 faults: u64,
4060 cow_faults: u64,
4061 lookups: u64,
4062 hits: u64,
4063 purges: u64,
4064 purgeable_count: natural_t,
4065 speculative_count: natural_t,
4066 decompressions: u64,
4067 compressions: u64,
4068 swapins: u64,
4069 swapouts: u64,
4070 compressor_page_count: natural_t,
4071 throttled_count: natural_t,
4072 external_page_count: natural_t,
4073 internal_page_count: natural_t,
4074 total_uncompressed_pages_in_compressor: u64,
4075};
4076
4077pub const vm_statistics64_t = *vm_statistics64;
4078pub const vm_statistics64_data_t = vm_statistics64;