Chromium Code Reviews| 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 // This file contains routines for gathering resource statistics for processes | 5 // This file contains routines for gathering resource statistics for processes |
| 6 // running on the system. | 6 // running on the system. |
| 7 | 7 |
| 8 #ifndef BASE_PROCESS_PROCESS_METRICS_H_ | 8 #ifndef BASE_PROCESS_PROCESS_METRICS_H_ |
| 9 #define BASE_PROCESS_PROCESS_METRICS_H_ | 9 #define BASE_PROCESS_PROCESS_METRICS_H_ |
| 10 | 10 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // function is somewhat expensive on Windows (a few ms per process). | 160 // function is somewhat expensive on Windows (a few ms per process). |
| 161 bool GetProportionalSetSizeBytes(uint64_t* pss_bytes) const; | 161 bool GetProportionalSetSizeBytes(uint64_t* pss_bytes) const; |
| 162 | 162 |
| 163 #if defined(OS_MACOSX) | 163 #if defined(OS_MACOSX) |
| 164 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This | 164 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This |
| 165 // is more efficient on Mac OS X, as the two can be retrieved with a single | 165 // is more efficient on Mac OS X, as the two can be retrieved with a single |
| 166 // system call. | 166 // system call. |
| 167 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, | 167 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, |
| 168 WorkingSetKBytes* ws_usage) const; | 168 WorkingSetKBytes* ws_usage) const; |
| 169 | 169 |
| 170 // Returns the physical footprint, only available on macOS 10.11+. This | 170 struct TaskVMInfo { |
| 171 // measures anonymous, non-discardable memory. Returns 0 on error, or if the | 171 // Only available on macOS 10.12+. |
| 172 // measurement was unavailable. | 172 // Anonymous, non-discardable memory, including non-volatile IOKit. |
| 173 size_t GetPhysicalFootprint() const; | 173 uint64_t phys_footprint = 0; |
|
Mark Mentovai
2017/04/25 20:29:44
Do these measure bytes or pages? Say so somewhere,
erikchen
2017/04/25 20:49:46
Added a comment.
| |
| 174 | |
| 175 // Anonymous, non-discardable, non-compressed memory, excluding IOKit. | |
| 176 uint64_t internal = 0; | |
| 177 | |
| 178 // Compressed memory. | |
| 179 uint64_t compressed = 0; | |
| 180 }; | |
| 181 TaskVMInfo GetTaskVMInfo() const; | |
| 174 | 182 |
| 175 // Returns private, shared, and total resident bytes. |locked_bytes| refers to | 183 // Returns private, shared, and total resident bytes. |locked_bytes| refers to |
| 176 // bytes that must stay resident. |locked_bytes| only counts bytes locked by | 184 // bytes that must stay resident. |locked_bytes| only counts bytes locked by |
| 177 // this task, not bytes locked by the kernel. | 185 // this task, not bytes locked by the kernel. |
| 178 bool GetMemoryBytes(size_t* private_bytes, | 186 bool GetMemoryBytes(size_t* private_bytes, |
| 179 size_t* shared_bytes, | 187 size_t* shared_bytes, |
| 180 size_t* resident_bytes, | 188 size_t* resident_bytes, |
| 181 size_t* locked_bytes) const; | 189 size_t* locked_bytes) const; |
| 182 #endif | 190 #endif |
| 183 | 191 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 // |size| and |info| are output parameters, only valid on Success. | 528 // |size| and |info| are output parameters, only valid on Success. |
| 521 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, | 529 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, |
| 522 mach_vm_size_t* size, | 530 mach_vm_size_t* size, |
| 523 mach_vm_address_t* address, | 531 mach_vm_address_t* address, |
| 524 vm_region_basic_info_64* info); | 532 vm_region_basic_info_64* info); |
| 525 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 533 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 526 | 534 |
| 527 } // namespace base | 535 } // namespace base |
| 528 | 536 |
| 529 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 537 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
| OLD | NEW |