| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 size_t GetPeakPagefileUsage() const; | 129 size_t GetPeakPagefileUsage() const; |
| 130 // Returns the current working set size, in bytes. On Linux, this returns | 130 // Returns the current working set size, in bytes. On Linux, this returns |
| 131 // the resident set size. | 131 // the resident set size. |
| 132 size_t GetWorkingSetSize() const; | 132 size_t GetWorkingSetSize() const; |
| 133 // Returns the peak working set size, in bytes. | 133 // Returns the peak working set size, in bytes. |
| 134 size_t GetPeakWorkingSetSize() const; | 134 size_t GetPeakWorkingSetSize() const; |
| 135 // Returns private and sharedusage, in bytes. Private bytes is the amount of | 135 // Returns private and sharedusage, in bytes. Private bytes is the amount of |
| 136 // memory currently allocated to a process that cannot be shared. Returns | 136 // memory currently allocated to a process that cannot be shared. Returns |
| 137 // false on platform specific error conditions. Note: |private_bytes| | 137 // false on platform specific error conditions. Note: |private_bytes| |
| 138 // returns 0 on unsupported OSes: prior to XP SP2. | 138 // returns 0 on unsupported OSes: prior to XP SP2. |
| 139 bool GetMemoryBytes(size_t* private_bytes, | 139 bool GetMemoryBytes(size_t* private_bytes, size_t* shared_bytes) const; |
| 140 size_t* shared_bytes); | |
| 141 // Fills a CommittedKBytes with both resident and paged | 140 // Fills a CommittedKBytes with both resident and paged |
| 142 // memory usage as per definition of CommittedBytes. | 141 // memory usage as per definition of CommittedBytes. |
| 143 void GetCommittedKBytes(CommittedKBytes* usage) const; | 142 void GetCommittedKBytes(CommittedKBytes* usage) const; |
| 144 // Fills a WorkingSetKBytes containing resident private and shared memory | 143 // Fills a WorkingSetKBytes containing resident private and shared memory |
| 145 // usage in bytes, as per definition of WorkingSetBytes. Note that this | 144 // usage in bytes, as per definition of WorkingSetBytes. Note that this |
| 146 // function is somewhat expensive on Windows (a few ms per process). | 145 // function is somewhat expensive on Windows (a few ms per process). |
| 147 bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const; | 146 bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const; |
| 148 // Computes pss (proportional set size) of a process. Note that this | 147 // Computes pss (proportional set size) of a process. Note that this |
| 149 // function is somewhat expensive on Windows (a few ms per process). | 148 // function is somewhat expensive on Windows (a few ms per process). |
| 150 bool GetProportionalSetSizeBytes(uint64_t* pss_bytes) const; | 149 bool GetProportionalSetSizeBytes(uint64_t* pss_bytes) const; |
| 151 | 150 |
| 152 #if defined(OS_MACOSX) | 151 #if defined(OS_MACOSX) |
| 153 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This | 152 // Fills both CommitedKBytes and WorkingSetKBytes in a single operation. This |
| 154 // is more efficient on Mac OS X, as the two can be retrieved with a single | 153 // is more efficient on Mac OS X, as the two can be retrieved with a single |
| 155 // system call. | 154 // system call. |
| 156 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, | 155 bool GetCommittedAndWorkingSetKBytes(CommittedKBytes* usage, |
| 157 WorkingSetKBytes* ws_usage) const; | 156 WorkingSetKBytes* ws_usage) const; |
| 157 // Returns private, shared, and total resident bytes. |
| 158 bool GetMemoryBytes(size_t* private_bytes, |
| 159 size_t* shared_bytes, |
| 160 size_t* resident_bytes) const; |
| 158 #endif | 161 #endif |
| 159 | 162 |
| 160 // Returns the CPU usage in percent since the last time this method or | 163 // Returns the CPU usage in percent since the last time this method or |
| 161 // GetPlatformIndependentCPUUsage() was called. The first time this method | 164 // GetPlatformIndependentCPUUsage() was called. The first time this method |
| 162 // is called it returns 0 and will return the actual CPU info on subsequent | 165 // is called it returns 0 and will return the actual CPU info on subsequent |
| 163 // calls. On Windows, the CPU usage value is for all CPUs. So if you have | 166 // calls. On Windows, the CPU usage value is for all CPUs. So if you have |
| 164 // 2 CPUs and your process is using all the cycles of 1 CPU and not the other | 167 // 2 CPUs and your process is using all the cycles of 1 CPU and not the other |
| 165 // CPU, this method returns 50. | 168 // CPU, this method returns 50. |
| 166 double GetCPUUsage(); | 169 double GetCPUUsage(); |
| 167 | 170 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 SystemDiskInfo disk_info_; | 433 SystemDiskInfo disk_info_; |
| 431 #endif | 434 #endif |
| 432 #if defined(OS_CHROMEOS) | 435 #if defined(OS_CHROMEOS) |
| 433 SwapInfo swap_info_; | 436 SwapInfo swap_info_; |
| 434 #endif | 437 #endif |
| 435 }; | 438 }; |
| 436 | 439 |
| 437 } // namespace base | 440 } // namespace base |
| 438 | 441 |
| 439 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 442 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
| OLD | NEW |