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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // returns 0 on unsupported OSes: prior to XP SP2. | 136 // returns 0 on unsupported OSes: prior to XP SP2. |
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. | 143 // usage in bytes, as per definition of WorkingSetBytes. |
144 bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const; | 144 bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const; |
145 | 145 |
| 146 #if defined(OS_MACOSX) |
| 147 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This |
| 148 // is more efficient on Mac OS X, as the two can be retrieved with a single |
| 149 // system call. |
| 150 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, |
| 151 WorkingSetKBytes* ws_usage) const; |
| 152 #endif |
| 153 |
146 // Returns the CPU usage in percent since the last time this method or | 154 // Returns the CPU usage in percent since the last time this method or |
147 // GetPlatformIndependentCPUUsage() was called. The first time this method | 155 // GetPlatformIndependentCPUUsage() was called. The first time this method |
148 // is called it returns 0 and will return the actual CPU info on subsequent | 156 // is called it returns 0 and will return the actual CPU info on subsequent |
149 // calls. On Windows, the CPU usage value is for all CPUs. So if you have | 157 // calls. On Windows, the CPU usage value is for all CPUs. So if you have |
150 // 2 CPUs and your process is using all the cycles of 1 CPU and not the other | 158 // 2 CPUs and your process is using all the cycles of 1 CPU and not the other |
151 // CPU, this method returns 50. | 159 // CPU, this method returns 50. |
152 double GetCPUUsage(); | 160 double GetCPUUsage(); |
153 | 161 |
154 // Returns the number of average idle cpu wakeups per second since the last | 162 // Returns the number of average idle cpu wakeups per second since the last |
155 // call. | 163 // call. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 SystemDiskInfo disk_info_; | 383 SystemDiskInfo disk_info_; |
376 #endif | 384 #endif |
377 #if defined(OS_CHROMEOS) | 385 #if defined(OS_CHROMEOS) |
378 SwapInfo swap_info_; | 386 SwapInfo swap_info_; |
379 #endif | 387 #endif |
380 }; | 388 }; |
381 | 389 |
382 } // namespace base | 390 } // namespace base |
383 | 391 |
384 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 392 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
OLD | NEW |