diff options
author | Han Ming Ong <hanming@apple.com> | 2013-06-26 22:52:37 +0000 |
---|---|---|
committer | Han Ming Ong <hanming@apple.com> | 2013-06-26 22:52:37 +0000 |
commit | b4e1d4c63088e2d9f233b2d04123e18d912896d7 (patch) | |
tree | 61418f2869597eec95661fb329c497def1b4932f /lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp | |
parent | b8c608ea39eec94a9e6b23cdd8a6087e07e86a5e (diff) | |
download | bcm5719-llvm-b4e1d4c63088e2d9f233b2d04123e18d912896d7.tar.gz bcm5719-llvm-b4e1d4c63088e2d9f233b2d04123e18d912896d7.zip |
<rdar://problem/14281898>
Much faster way to get dirty size.
llvm-svn: 185033
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp')
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp index 47f8f8a8fe3..f11906afd63 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp @@ -235,6 +235,22 @@ static uint64_t GetPhysicalMemory() void MachVMMemory::GetRegionSizes(task_t task, mach_vm_size_t &rsize, mach_vm_size_t &dirty_size) { +#if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22 + + task_vm_info_data_t vm_info; + mach_msg_type_number_t info_count; + kern_return_t kr; + + info_count = TASK_VM_INFO_COUNT; +#ifdef TASK_VM_INFO_PURGEABLE + kr = task_info(task, TASK_VM_INFO_PURGEABLE, (task_info_t)&vm_info, &info_count); +#else + kr = task_info(task, TASK_VM_INFO, (task_info_t)&vm_info, &info_count); +#endif + if (kr == KERN_SUCCESS) + dirty_size = vm_info.internal; + +#else mach_vm_address_t address = 0; mach_vm_size_t size; kern_return_t err = 0; @@ -285,6 +301,8 @@ MachVMMemory::GetRegionSizes(task_t task, mach_vm_size_t &rsize, mach_vm_size_t vm_size_t pagesize = PageSize (task); rsize = pages_resident * pagesize; dirty_size = pages_dirtied * pagesize; + +#endif } // Test whether the virtual address is within the architecture's shared region. |