mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Implement frontend_darwin_get_mem_free
This commit is contained in:
parent
19d4498d2c
commit
a01985273b
@ -681,6 +681,28 @@ static uint64_t frontend_darwin_get_mem_total(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint64_t frontend_darwin_get_mem_free(void)
|
||||
{
|
||||
#ifdef OSX
|
||||
vm_size_t page_size;
|
||||
vm_statistics64_data_t vm_stats;
|
||||
mach_port_t mach_port = mach_host_self();
|
||||
mach_msg_type_number_t count = sizeof(vm_stats) / sizeof(natural_t);
|
||||
|
||||
if (KERN_SUCCESS == host_page_size(mach_port, &page_size) &&
|
||||
KERN_SUCCESS == host_statistics64(mach_port, HOST_VM_INFO,
|
||||
(host_info64_t)&vm_stats, &count))
|
||||
{
|
||||
|
||||
long long used_memory = ((int64_t)vm_stats.active_count +
|
||||
(int64_t)vm_stats.inactive_count +
|
||||
(int64_t)vm_stats.wire_count) * (int64_t)page_size;
|
||||
return used_memory;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
frontend_ctx_driver_t frontend_ctx_darwin = {
|
||||
frontend_darwin_get_environment_settings,
|
||||
NULL, /* init */
|
||||
@ -698,6 +720,6 @@ frontend_ctx_driver_t frontend_ctx_darwin = {
|
||||
frontend_darwin_get_powerstate,
|
||||
frontend_darwin_parse_drive_list,
|
||||
frontend_darwin_get_mem_total,
|
||||
NULL, /* get_mem_free */
|
||||
frontend_darwin_get_mem_free,
|
||||
"darwin",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user