OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
6 // computing statistics of processes. | 6 // computing statistics of processes. |
7 | 7 |
8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 PortProvider* port_provider_; | 650 PortProvider* port_provider_; |
651 #elif defined(OS_POSIX) | 651 #elif defined(OS_POSIX) |
652 // Jiffie count at the last_time_ we updated. | 652 // Jiffie count at the last_time_ we updated. |
653 int last_cpu_; | 653 int last_cpu_; |
654 #endif // defined(OS_MACOSX) | 654 #endif // defined(OS_MACOSX) |
655 | 655 |
656 DISALLOW_COPY_AND_ASSIGN(ProcessMetrics); | 656 DISALLOW_COPY_AND_ASSIGN(ProcessMetrics); |
657 }; | 657 }; |
658 | 658 |
659 #if defined(OS_LINUX) | 659 #if defined(OS_LINUX) |
| 660 // Data from /proc/meminfo about system-wide memory consumption. |
| 661 // Values are in KB. |
| 662 struct SystemMemoryInfoKB { |
| 663 SystemMemoryInfoKB() : total(0), free(0), buffers(0), cached(0), |
| 664 active_anon(0), inactive_anon(0), shmem(0) {} |
| 665 int total; |
| 666 int free; |
| 667 int buffers; |
| 668 int cached; |
| 669 int active_anon; |
| 670 int inactive_anon; |
| 671 int shmem; |
| 672 }; |
660 // Retrieves data from /proc/meminfo about system-wide memory consumption. | 673 // Retrieves data from /proc/meminfo about system-wide memory consumption. |
661 // Values are in KB. Returns true on success. | 674 // Fills in the provided |meminfo| structure. Returns true on success. |
662 BASE_EXPORT bool GetSystemMemoryInfo(int* total_kb, int* free_kb, | 675 // Exposed for memory debugging widget. |
663 int* buffers_kb, int* cache_kb, | 676 BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo); |
664 int* shmem_kb); | |
665 #endif | 677 #endif |
666 | 678 |
667 // Returns the memory committed by the system in KBytes. | 679 // Returns the memory committed by the system in KBytes. |
668 // Returns 0 if it can't compute the commit charge. | 680 // Returns 0 if it can't compute the commit charge. |
669 BASE_EXPORT size_t GetSystemCommitCharge(); | 681 BASE_EXPORT size_t GetSystemCommitCharge(); |
670 | 682 |
671 // Enables low fragmentation heap (LFH) for every heaps of this process. This | 683 // Enables low fragmentation heap (LFH) for every heaps of this process. This |
672 // won't have any effect on heaps created after this function call. It will not | 684 // won't have any effect on heaps created after this function call. It will not |
673 // modify data allocated in the heaps before calling this function. So it is | 685 // modify data allocated in the heaps before calling this function. So it is |
674 // better to call this function early in initialization and again before | 686 // better to call this function early in initialization and again before |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // instance running inside the parent. The parent's Breakpad instance should | 718 // instance running inside the parent. The parent's Breakpad instance should |
707 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 719 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
708 // in the child after forking will restore the standard exception handler. | 720 // in the child after forking will restore the standard exception handler. |
709 // See http://crbug.com/20371/ for more details. | 721 // See http://crbug.com/20371/ for more details. |
710 void RestoreDefaultExceptionHandler(); | 722 void RestoreDefaultExceptionHandler(); |
711 #endif // defined(OS_MACOSX) | 723 #endif // defined(OS_MACOSX) |
712 | 724 |
713 } // namespace base | 725 } // namespace base |
714 | 726 |
715 #endif // BASE_PROCESS_UTIL_H_ | 727 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |