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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 bool CalculateFreeMemory(FreeMBytes* free) const; | 161 bool CalculateFreeMemory(FreeMBytes* free) const; |
| 162 | 162 |
| 163 // Returns the CPU usage in percent since the last time this method was | 163 // Returns the CPU usage in percent since the last time this method was |
| 164 // called. The first time this method is called it returns 0 and will return | 164 // called. The first time this method is called it returns 0 and will return |
| 165 // the actual CPU info on subsequent calls. | 165 // the actual CPU info on subsequent calls. |
| 166 // On Windows, the CPU usage value is for all CPUs. So if you have 2 CPUs and | 166 // On Windows, the CPU usage value is for all CPUs. So if you have 2 CPUs and |
| 167 // your process is using all the cycles of 1 CPU and not the other CPU, this | 167 // your process is using all the cycles of 1 CPU and not the other CPU, this |
| 168 // method returns 50. | 168 // method returns 50. |
| 169 double GetCPUUsage(); | 169 double GetCPUUsage(); |
| 170 | 170 |
| 171 // Same as GetCPUUsage(), but will return consistent returns on all platforms | |
| 172 // including Windows. | |
|
Alexei Svitkine (slow)
2013/10/24 14:52:00
Mention what the consistent values actually are.
oystein (OOO til 10th of July)
2013/10/24 15:01:06
Actually meant to write "values" rather than "retu
Alexei Svitkine (slow)
2013/10/24 15:13:33
Not necessarily repeating, you can refer to it - j
oystein (OOO til 10th of July)
2013/10/24 15:25:51
Good point; done.
| |
| 173 double GetPlatformIndependentCPUUsage(); | |
| 174 | |
| 171 // Retrieves accounting information for all I/O operations performed by the | 175 // Retrieves accounting information for all I/O operations performed by the |
| 172 // process. | 176 // process. |
| 173 // If IO information is retrieved successfully, the function returns true | 177 // If IO information is retrieved successfully, the function returns true |
| 174 // and fills in the IO_COUNTERS passed in. The function returns false | 178 // and fills in the IO_COUNTERS passed in. The function returns false |
| 175 // otherwise. | 179 // otherwise. |
| 176 bool GetIOCounters(IoCounters* io_counters) const; | 180 bool GetIOCounters(IoCounters* io_counters) const; |
| 177 | 181 |
| 178 private: | 182 private: |
| 179 #if !defined(OS_MACOSX) || defined(OS_IOS) | 183 #if !defined(OS_MACOSX) || defined(OS_IOS) |
| 180 explicit ProcessMetrics(ProcessHandle process); | 184 explicit ProcessMetrics(ProcessHandle process); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 SystemDiskInfo disk_info_; | 360 SystemDiskInfo disk_info_; |
| 357 #endif | 361 #endif |
| 358 #if defined(OS_CHROMEOS) | 362 #if defined(OS_CHROMEOS) |
| 359 SwapInfo swap_info_; | 363 SwapInfo swap_info_; |
| 360 #endif | 364 #endif |
| 361 }; | 365 }; |
| 362 | 366 |
| 363 } // namespace base | 367 } // namespace base |
| 364 | 368 |
| 365 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 369 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
| OLD | NEW |