diff options
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp')
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp index d13cbfe0131..c0ce9c6ec93 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp @@ -397,21 +397,29 @@ static void GetMemorySizes(task_t task, cpu_type_t cputype, nub_process_t pid, m } nub_bool_t -MachVMMemory::GetMemoryProfile(task_t task, struct task_basic_info ti, cpu_type_t cputype, nub_process_t pid, vm_statistics_data_t &vm_stats, uint64_t &physical_memory, mach_vm_size_t &rprvt, mach_vm_size_t &rsize, mach_vm_size_t &vprvt, mach_vm_size_t &vsize, mach_vm_size_t &dirty_size) +MachVMMemory::GetMemoryProfile(DNBProfileDataScanType scanType, task_t task, struct task_basic_info ti, cpu_type_t cputype, nub_process_t pid, vm_statistics_data_t &vm_stats, uint64_t &physical_memory, mach_vm_size_t &rprvt, mach_vm_size_t &rsize, mach_vm_size_t &vprvt, mach_vm_size_t &vsize, mach_vm_size_t &dirty_size) { - static mach_port_t localHost = mach_host_self(); - mach_msg_type_number_t count = HOST_VM_INFO_COUNT; - host_statistics(localHost, HOST_VM_INFO, (host_info_t)&vm_stats, &count); - vm_stats.wire_count += GetStolenPages(); - physical_memory = GetPhysicalMemory(); - - // This uses vmmap strategy. We don't use the returned rsize for now. We prefer to match top's version since that's what we do for the rest of the metrics. - GetRegionSizes(task, rsize, dirty_size); + if (scanType & eProfileHostMemory) + physical_memory = GetPhysicalMemory(); - GetMemorySizes(task, cputype, pid, rprvt, vprvt); + if (scanType & eProfileMemory) + { + static mach_port_t localHost = mach_host_self(); + mach_msg_type_number_t count = HOST_VM_INFO_COUNT; + host_statistics(localHost, HOST_VM_INFO, (host_info_t)&vm_stats, &count); + vm_stats.wire_count += GetStolenPages(); + + GetMemorySizes(task, cputype, pid, rprvt, vprvt); + + rsize = ti.resident_size; + vsize = ti.virtual_size; + } - rsize = ti.resident_size; - vsize = ti.virtual_size; + if (scanType & eProfileMemoryDirtyPage) + { + // This uses vmmap strategy. We don't use the returned rsize for now. We prefer to match top's version since that's what we do for the rest of the metrics. + GetRegionSizes(task, rsize, dirty_size); + } return true; } |