From 18d52576a98355238885f1c7ba2055ddada27c04 Mon Sep 17 00:00:00 2001 From: SuCicada Date: Wed, 10 Apr 2024 11:13:43 +0900 Subject: [PATCH] darwin: Enhance memory metrics support for Apple Silicon (ARM64) --- darwin/DarwinMachine.c | 2 +- darwin/DarwinMachine.h | 2 +- darwin/Platform.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/darwin/DarwinMachine.c b/darwin/DarwinMachine.c index 388299af6..1e94d9193 100644 --- a/darwin/DarwinMachine.c +++ b/darwin/DarwinMachine.c @@ -63,7 +63,7 @@ static void DarwinMachine_getVMStats(DarwinMachine* this) { #if defined(__LP64__) mach_msg_type_number_t info_size = HOST_VM_INFO64_COUNT; - if (host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info_t)&this->vm_stats64, &info_size) != 0) { + if (host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info_t)&this->vm_stats, &info_size) != 0) { CRT_fatalError("Unable to retrieve VM statistics64"); } #else diff --git a/darwin/DarwinMachine.h b/darwin/DarwinMachine.h index eff94277d..7927fb446 100644 --- a/darwin/DarwinMachine.h +++ b/darwin/DarwinMachine.h @@ -19,7 +19,7 @@ typedef struct DarwinMachine_ { host_basic_info_data_t host_info; #if defined(__LP64__) - vm_statistics64_data_t vm_stats64; + vm_statistics64_data_t vm_stats; #else vm_statistics_data_t vm_stats; #endif diff --git a/darwin/Platform.c b/darwin/Platform.c index 928c42de5..7bb5a1292 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -290,10 +290,10 @@ double Platform_setCPUValues(Meter* mtr, unsigned int cpu) { return CLAMP(total, 0.0, 100.0); } -void Platform_setMemoryValues(Meter *mtr) { - const DarwinMachine *dhost = (const DarwinMachine *) mtr->host; +void Platform_setMemoryValues(Meter* mtr) { + const DarwinMachine* dhost = (const DarwinMachine*) mtr->host; #if defined(__LP64__) - const struct vm_statistics64 *vm = &dhost->vm_stats64; + const struct vm_statistics64* vm = &dhost->vm_stats; #else const struct vm_statistics* vm = &dhost->vm_stats; #endif