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