Skip to content

Commit

Permalink
darwin: Enhance memory metrics support for Apple Silicon (ARM64)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuCicada committed Apr 10, 2024
1 parent f1e2385 commit 18d5257
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion darwin/DarwinMachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion darwin/DarwinMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions darwin/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18d5257

Please sign in to comment.