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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 bool GetMemoryBytes(size_t* private_bytes, | 137 bool GetMemoryBytes(size_t* private_bytes, |
138 size_t* shared_bytes); | 138 size_t* shared_bytes); |
139 // Fills a CommittedKBytes with both resident and paged | 139 // Fills a CommittedKBytes with both resident and paged |
140 // memory usage as per definition of CommittedBytes. | 140 // memory usage as per definition of CommittedBytes. |
141 void GetCommittedKBytes(CommittedKBytes* usage) const; | 141 void GetCommittedKBytes(CommittedKBytes* usage) const; |
142 // Fills a WorkingSetKBytes containing resident private and shared memory | 142 // Fills a WorkingSetKBytes containing resident private and shared memory |
143 // usage in bytes, as per definition of WorkingSetBytes. Note that this | 143 // usage in bytes, as per definition of WorkingSetBytes. Note that this |
144 // function is somewhat expensive on Windows (a few ms per process). | 144 // function is somewhat expensive on Windows (a few ms per process). |
145 bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const; | 145 bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const; |
146 | 146 |
| 147 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 148 // Returns the current and the peak resident set size on passing a file |
| 149 // descriptor to "proc/<pid>/status" file: |
| 150 size_t GetWorkingSetSize(int proc_status_fd) const; |
| 151 size_t GetPeakWorkingSetSize(int proc_status_fd) const; |
| 152 #endif |
| 153 |
147 #if defined(OS_MACOSX) | 154 #if defined(OS_MACOSX) |
148 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This | 155 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This |
149 // is more efficient on Mac OS X, as the two can be retrieved with a single | 156 // is more efficient on Mac OS X, as the two can be retrieved with a single |
150 // system call. | 157 // system call. |
151 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, | 158 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, |
152 WorkingSetKBytes* ws_usage) const; | 159 WorkingSetKBytes* ws_usage) const; |
153 #endif | 160 #endif |
154 | 161 |
155 // Returns the CPU usage in percent since the last time this method or | 162 // Returns the CPU usage in percent since the last time this method or |
156 // GetPlatformIndependentCPUUsage() was called. The first time this method | 163 // GetPlatformIndependentCPUUsage() was called. The first time this method |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 SystemDiskInfo disk_info_; | 410 SystemDiskInfo disk_info_; |
404 #endif | 411 #endif |
405 #if defined(OS_CHROMEOS) | 412 #if defined(OS_CHROMEOS) |
406 SwapInfo swap_info_; | 413 SwapInfo swap_info_; |
407 #endif | 414 #endif |
408 }; | 415 }; |
409 | 416 |
410 } // namespace base | 417 } // namespace base |
411 | 418 |
412 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 419 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
OLD | NEW |