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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 ProcessHandle process_; | 196 ProcessHandle process_; |
197 | 197 |
198 int processor_count_; | 198 int processor_count_; |
199 | 199 |
200 // Used to store the previous times and CPU usage counts so we can | 200 // Used to store the previous times and CPU usage counts so we can |
201 // compute the CPU usage between calls. | 201 // compute the CPU usage between calls. |
202 TimeTicks last_cpu_time_; | 202 TimeTicks last_cpu_time_; |
203 int64 last_system_time_; | 203 int64 last_system_time_; |
204 | 204 |
| 205 #if defined(OS_MACOSX) |
205 // Same thing for idle wakeups. | 206 // Same thing for idle wakeups. |
206 TimeTicks last_idle_wakeups_time_; | 207 TimeTicks last_idle_wakeups_time_; |
207 int64 last_absolute_idle_wakeups_; | 208 uint64 last_absolute_idle_wakeups_; |
| 209 #endif |
208 | 210 |
209 #if !defined(OS_IOS) | 211 #if !defined(OS_IOS) |
210 #if defined(OS_MACOSX) | 212 #if defined(OS_MACOSX) |
211 // Queries the port provider if it's set. | 213 // Queries the port provider if it's set. |
212 mach_port_t TaskForPid(ProcessHandle process) const; | 214 mach_port_t TaskForPid(ProcessHandle process) const; |
213 | 215 |
214 PortProvider* port_provider_; | 216 PortProvider* port_provider_; |
215 #elif defined(OS_POSIX) | 217 #elif defined(OS_POSIX) |
216 // Jiffie count at the last_cpu_time_ we updated. | 218 // Jiffie count at the last_cpu_time_ we updated. |
217 int last_cpu_; | 219 int last_cpu_; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 uint64 read_time; | 315 uint64 read_time; |
314 uint64 writes; | 316 uint64 writes; |
315 uint64 writes_merged; | 317 uint64 writes_merged; |
316 uint64 sectors_written; | 318 uint64 sectors_written; |
317 uint64 write_time; | 319 uint64 write_time; |
318 uint64 io; | 320 uint64 io; |
319 uint64 io_time; | 321 uint64 io_time; |
320 uint64 weighted_io_time; | 322 uint64 weighted_io_time; |
321 }; | 323 }; |
322 | 324 |
323 // Checks whether the candidate string is a valid disk name, [sh]d[a-z]+ | 325 // Checks whether the candidate string is a valid disk name, [hsv]d[a-z]+ |
324 // for a generic disk or mmcblk[0-9]+ for the MMC case. | 326 // for a generic disk or mmcblk[0-9]+ for the MMC case. |
325 // Names of disk partitions (e.g. sda1) are not valid. | 327 // Names of disk partitions (e.g. sda1) are not valid. |
326 BASE_EXPORT bool IsValidDiskName(const std::string& candidate); | 328 BASE_EXPORT bool IsValidDiskName(const std::string& candidate); |
327 | 329 |
328 // Retrieves data from /proc/diskstats about system-wide disk I/O. | 330 // Retrieves data from /proc/diskstats about system-wide disk I/O. |
329 // Fills in the provided |diskinfo| structure. Returns true on success. | 331 // Fills in the provided |diskinfo| structure. Returns true on success. |
330 BASE_EXPORT bool GetSystemDiskInfo(SystemDiskInfo* diskinfo); | 332 BASE_EXPORT bool GetSystemDiskInfo(SystemDiskInfo* diskinfo); |
331 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 333 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
332 | 334 |
333 #if defined(OS_CHROMEOS) | 335 #if defined(OS_CHROMEOS) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 SystemDiskInfo disk_info_; | 379 SystemDiskInfo disk_info_; |
378 #endif | 380 #endif |
379 #if defined(OS_CHROMEOS) | 381 #if defined(OS_CHROMEOS) |
380 SwapInfo swap_info_; | 382 SwapInfo swap_info_; |
381 #endif | 383 #endif |
382 }; | 384 }; |
383 | 385 |
384 } // namespace base | 386 } // namespace base |
385 | 387 |
386 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 388 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
OLD | NEW |