| Index: base/process/process_metrics_mac.cc
|
| diff --git a/base/process/process_metrics_mac.cc b/base/process/process_metrics_mac.cc
|
| index a3c2d6a14aa6acbd2e07e9afd6a55a836bbb3f10..3e1c36a904f9cddcd3bdccf17414d15c80001176 100644
|
| --- a/base/process/process_metrics_mac.cc
|
| +++ b/base/process/process_metrics_mac.cc
|
| @@ -80,7 +80,8 @@ bool IsAddressInSharedRegion(mach_vm_address_t addr, cpu_type_t type) {
|
|
|
| } // namespace
|
|
|
| -SystemMemoryInfoKB::SystemMemoryInfoKB() : total(0), free(0) {}
|
| +SystemMemoryInfoKB::SystemMemoryInfoKB()
|
| + : total(0), free(0), speculative(0), file_backed(0), purgeable(0) {}
|
|
|
| SystemMemoryInfoKB::SystemMemoryInfoKB(const SystemMemoryInfoKB& other) =
|
| default;
|
| @@ -377,7 +378,6 @@ size_t GetSystemCommitCharge() {
|
| return (data.active_count * PAGE_SIZE) / 1024;
|
| }
|
|
|
| -// On Mac, We only get total memory and free memory from the system.
|
| bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
|
| struct host_basic_info hostinfo;
|
| mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
|
| @@ -390,17 +390,24 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
|
| DCHECK_EQ(HOST_BASIC_INFO_COUNT, count);
|
| meminfo->total = static_cast<int>(hostinfo.max_mem / 1024);
|
|
|
| - vm_statistics_data_t vm_info;
|
| - count = HOST_VM_INFO_COUNT;
|
| + vm_statistics64_data_t vm_info;
|
| + count = HOST_VM_INFO64_COUNT;
|
|
|
| - if (host_statistics(host.get(), HOST_VM_INFO,
|
| - reinterpret_cast<host_info_t>(&vm_info),
|
| - &count) != KERN_SUCCESS) {
|
| + if (host_statistics64(host.get(), HOST_VM_INFO64,
|
| + reinterpret_cast<host_info64_t>(&vm_info),
|
| + &count) != KERN_SUCCESS) {
|
| return false;
|
| }
|
| + DCHECK_EQ(HOST_VM_INFO64_COUNT, count);
|
|
|
| meminfo->free = static_cast<int>(
|
| (vm_info.free_count - vm_info.speculative_count) * PAGE_SIZE / 1024);
|
| + meminfo->speculative =
|
| + static_cast<int>(vm_info.speculative_count * PAGE_SIZE / 1024);
|
| + meminfo->file_backed =
|
| + static_cast<int>(vm_info.external_page_count * PAGE_SIZE / 1024);
|
| + meminfo->purgeable =
|
| + static_cast<int>(vm_info.purgeable_count * PAGE_SIZE / 1024);
|
|
|
| return true;
|
| }
|
|
|