| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // Returns the maximum number of file descriptors that can be open by a process | 297 // Returns the maximum number of file descriptors that can be open by a process |
| 298 // at once. If the number is unavailable, a conservative best guess is returned. | 298 // at once. If the number is unavailable, a conservative best guess is returned. |
| 299 BASE_EXPORT size_t GetMaxFds(); | 299 BASE_EXPORT size_t GetMaxFds(); |
| 300 | 300 |
| 301 // Sets the file descriptor soft limit to |max_descriptors| or the OS hard | 301 // Sets the file descriptor soft limit to |max_descriptors| or the OS hard |
| 302 // limit, whichever is lower. | 302 // limit, whichever is lower. |
| 303 BASE_EXPORT void SetFdLimit(unsigned int max_descriptors); | 303 BASE_EXPORT void SetFdLimit(unsigned int max_descriptors); |
| 304 #endif // defined(OS_POSIX) | 304 #endif // defined(OS_POSIX) |
| 305 | 305 |
| 306 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ | 306 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
| 307 defined(OS_ANDROID) || defined(OS_AIX) | 307 defined(OS_ANDROID) || defined(OS_AIX) || defined(OS_FUCHSIA) |
| 308 // Data about system-wide memory consumption. Values are in KB. Available on | 308 // Data about system-wide memory consumption. Values are in KB. Available on |
| 309 // Windows, Mac, Linux, Android and Chrome OS. | 309 // Windows, Mac, Linux, Android and Chrome OS. |
| 310 // | 310 // |
| 311 // Total memory are available on all platforms that implement | 311 // Total memory are available on all platforms that implement |
| 312 // GetSystemMemoryInfo(). Total/free swap memory are available on all platforms | 312 // GetSystemMemoryInfo(). Total/free swap memory are available on all platforms |
| 313 // except on Mac. Buffers/cached/active_anon/inactive_anon/active_file/ | 313 // except on Mac. Buffers/cached/active_anon/inactive_anon/active_file/ |
| 314 // inactive_file/dirty/reclaimable/pswpin/pswpout/pgmajfault are available on | 314 // inactive_file/dirty/reclaimable/pswpin/pswpout/pgmajfault are available on |
| 315 // Linux/Android/Chrome OS. Shmem/slab/gem_objects/gem_size are Chrome OS only. | 315 // Linux/Android/Chrome OS. Shmem/slab/gem_objects/gem_size are Chrome OS only. |
| 316 // Speculative/file_backed/purgeable are Mac and iOS only. | 316 // Speculative/file_backed/purgeable are Mac and iOS only. |
| 317 // Free is absent on Windows (see "avail_phys" below). | 317 // Free is absent on Windows (see "avail_phys" below). |
| (...skipping 26 matching lines...) Expand all Loading... |
| 344 // be 0 in earlier kernel versions. | 344 // be 0 in earlier kernel versions. |
| 345 // Note: it includes _all_ file-backed memory (active + inactive). | 345 // Note: it includes _all_ file-backed memory (active + inactive). |
| 346 int available = 0; | 346 int available = 0; |
| 347 #endif | 347 #endif |
| 348 | 348 |
| 349 #if !defined(OS_MACOSX) | 349 #if !defined(OS_MACOSX) |
| 350 int swap_total = 0; | 350 int swap_total = 0; |
| 351 int swap_free = 0; | 351 int swap_free = 0; |
| 352 #endif | 352 #endif |
| 353 | 353 |
| 354 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) | 354 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) || \ |
| 355 defined(OS_FUCHSIA) |
| 355 int buffers = 0; | 356 int buffers = 0; |
| 356 int cached = 0; | 357 int cached = 0; |
| 357 int active_anon = 0; | 358 int active_anon = 0; |
| 358 int inactive_anon = 0; | 359 int inactive_anon = 0; |
| 359 int active_file = 0; | 360 int active_file = 0; |
| 360 int inactive_file = 0; | 361 int inactive_file = 0; |
| 361 int dirty = 0; | 362 int dirty = 0; |
| 362 int reclaimable = 0; | 363 int reclaimable = 0; |
| 363 | 364 |
| 364 // vmstats data. | 365 // vmstats data. |
| 365 unsigned long pswpin = 0; | 366 unsigned long pswpin = 0; |
| 366 unsigned long pswpout = 0; | 367 unsigned long pswpout = 0; |
| 367 unsigned long pgmajfault = 0; | 368 unsigned long pgmajfault = 0; |
| 368 #endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) | 369 #endif // defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_AIX) || |
| 370 // defined(OS_FUCHSIA) |
| 369 | 371 |
| 370 #if defined(OS_CHROMEOS) | 372 #if defined(OS_CHROMEOS) |
| 371 int shmem = 0; | 373 int shmem = 0; |
| 372 int slab = 0; | 374 int slab = 0; |
| 373 // Gem data will be -1 if not supported. | 375 // Gem data will be -1 if not supported. |
| 374 int gem_objects = -1; | 376 int gem_objects = -1; |
| 375 long long gem_size = -1; | 377 long long gem_size = -1; |
| 376 #endif // defined(OS_CHROMEOS) | 378 #endif // defined(OS_CHROMEOS) |
| 377 | 379 |
| 378 #if defined(OS_MACOSX) | 380 #if defined(OS_MACOSX) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // |size| and |info| are output parameters, only valid on Success. | 539 // |size| and |info| are output parameters, only valid on Success. |
| 538 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, | 540 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, |
| 539 mach_vm_size_t* size, | 541 mach_vm_size_t* size, |
| 540 mach_vm_address_t* address, | 542 mach_vm_address_t* address, |
| 541 vm_region_basic_info_64* info); | 543 vm_region_basic_info_64* info); |
| 542 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 544 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 543 | 545 |
| 544 } // namespace base | 546 } // namespace base |
| 545 | 547 |
| 546 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 548 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
| OLD | NEW |