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 // Measured in bytes. |
| 174 uint64_t phys_footprint = 0; |
| 175 |
| 176 // Anonymous, non-discardable, non-compressed memory, excluding IOKit. |
| 177 // Measured in bytes. |
| 178 uint64_t internal = 0; |
| 179 |
| 180 // Compressed memory measured in bytes. |
| 181 uint64_t compressed = 0; |
| 182 }; |
| 183 TaskVMInfo GetTaskVMInfo() const; |
174 | 184 |
175 // Returns private, shared, and total resident bytes. |locked_bytes| refers to | 185 // Returns private, shared, and total resident bytes. |locked_bytes| refers to |
176 // bytes that must stay resident. |locked_bytes| only counts bytes locked by | 186 // bytes that must stay resident. |locked_bytes| only counts bytes locked by |
177 // this task, not bytes locked by the kernel. | 187 // this task, not bytes locked by the kernel. |
178 bool GetMemoryBytes(size_t* private_bytes, | 188 bool GetMemoryBytes(size_t* private_bytes, |
179 size_t* shared_bytes, | 189 size_t* shared_bytes, |
180 size_t* resident_bytes, | 190 size_t* resident_bytes, |
181 size_t* locked_bytes) const; | 191 size_t* locked_bytes) const; |
182 #endif | 192 #endif |
183 | 193 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // |size| and |info| are output parameters, only valid on Success. | 530 // |size| and |info| are output parameters, only valid on Success. |
521 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, | 531 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, |
522 mach_vm_size_t* size, | 532 mach_vm_size_t* size, |
523 mach_vm_address_t* address, | 533 mach_vm_address_t* address, |
524 vm_region_basic_info_64* info); | 534 vm_region_basic_info_64* info); |
525 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 535 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
526 | 536 |
527 } // namespace base | 537 } // namespace base |
528 | 538 |
529 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 539 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
OLD | NEW |