| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process/process_metrics.h" | 5 #include "base/process/process_metrics.h" |
| 6 | 6 |
| 7 #include <mach/mach.h> | 7 #include <mach/mach.h> |
| 8 #include <mach/mach_vm.h> | 8 #include <mach/mach_vm.h> |
| 9 #include <mach/shared_region.h> | 9 #include <mach/shared_region.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 usage->image = 0; | 282 usage->image = 0; |
| 283 | 283 |
| 284 ws_usage->priv = task_info_data.resident_size / 1024; | 284 ws_usage->priv = task_info_data.resident_size / 1024; |
| 285 ws_usage->shareable = 0; | 285 ws_usage->shareable = 0; |
| 286 ws_usage->shared = 0; | 286 ws_usage->shared = 0; |
| 287 | 287 |
| 288 return true; | 288 return true; |
| 289 } | 289 } |
| 290 | 290 |
| 291 size_t ProcessMetrics::GetPhysicalFootprint() const { | 291 size_t ProcessMetrics::GetPhysicalFootprint() const { |
| 292 if (mac::IsAtMostOS10_10()) | 292 if (mac::IsAtMostOS10_11()) |
| 293 return 0; | 293 return 0; |
| 294 | 294 |
| 295 ChromeTaskVMInfo task_vm_info; | 295 ChromeTaskVMInfo task_vm_info; |
| 296 mach_msg_type_number_t count = ChromeTaskVMInfoCount; | 296 mach_msg_type_number_t count = ChromeTaskVMInfoCount; |
| 297 kern_return_t result = | 297 kern_return_t result = |
| 298 task_info(TaskForPid(process_), TASK_VM_INFO, | 298 task_info(TaskForPid(process_), TASK_VM_INFO, |
| 299 reinterpret_cast<task_info_t>(&task_vm_info), &count); | 299 reinterpret_cast<task_info_t>(&task_vm_info), &count); |
| 300 if (result != KERN_SUCCESS) | 300 if (result != KERN_SUCCESS) |
| 301 return 0; | 301 return 0; |
| 302 return task_vm_info.phys_footprint; | 302 return task_vm_info.phys_footprint; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 task, address, size, VM_REGION_BASIC_INFO_64, | 496 task, address, size, VM_REGION_BASIC_INFO_64, |
| 497 reinterpret_cast<vm_region_info_t>(info), &info_count, &object_name); | 497 reinterpret_cast<vm_region_info_t>(info), &info_count, &object_name); |
| 498 // The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but | 498 // The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but |
| 499 // balance it with a deallocate in case this ever changes. See 10.9.2 | 499 // balance it with a deallocate in case this ever changes. See 10.9.2 |
| 500 // xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region. | 500 // xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region. |
| 501 mach_port_deallocate(task, object_name); | 501 mach_port_deallocate(task, object_name); |
| 502 return ParseOutputFromMachVMRegion(kr); | 502 return ParseOutputFromMachVMRegion(kr); |
| 503 } | 503 } |
| 504 | 504 |
| 505 } // namespace base | 505 } // namespace base |
| OLD | NEW |