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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 ProcessHandle* handle); | 159 ProcessHandle* handle); |
160 | 160 |
161 // Closes the process handle opened by OpenProcessHandle. | 161 // Closes the process handle opened by OpenProcessHandle. |
162 BASE_EXPORT void CloseProcessHandle(ProcessHandle process); | 162 BASE_EXPORT void CloseProcessHandle(ProcessHandle process); |
163 | 163 |
164 // Returns the unique ID for the specified process. This is functionally the | 164 // Returns the unique ID for the specified process. This is functionally the |
165 // same as Windows' GetProcessId(), but works on versions of Windows before | 165 // same as Windows' GetProcessId(), but works on versions of Windows before |
166 // Win XP SP1 as well. | 166 // Win XP SP1 as well. |
167 BASE_EXPORT ProcessId GetProcId(ProcessHandle process); | 167 BASE_EXPORT ProcessId GetProcId(ProcessHandle process); |
168 | 168 |
169 #if defined(OS_LINUX) || defined(OS_ANDROID) | 169 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD) |
170 // Returns the path to the executable of the given process. | 170 // Returns the path to the executable of the given process. |
171 BASE_EXPORT FilePath GetProcessExecutablePath(ProcessHandle process); | 171 BASE_EXPORT FilePath GetProcessExecutablePath(ProcessHandle process); |
| 172 #endif |
172 | 173 |
| 174 #if defined(OS_LINUX) || defined(OS_ANDROID) |
173 // Parse the data found in /proc/<pid>/stat and return the sum of the | 175 // Parse the data found in /proc/<pid>/stat and return the sum of the |
174 // CPU-related ticks. Returns -1 on parse error. | 176 // CPU-related ticks. Returns -1 on parse error. |
175 // Exposed for testing. | 177 // Exposed for testing. |
176 BASE_EXPORT int ParseProcStatCPU(const std::string& input); | 178 BASE_EXPORT int ParseProcStatCPU(const std::string& input); |
177 | 179 |
178 // The maximum allowed value for the OOM score. | 180 // The maximum allowed value for the OOM score. |
179 const int kMaxOomScore = 1000; | 181 const int kMaxOomScore = 1000; |
180 | 182 |
181 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will | 183 // This adjusts /proc/<pid>/oom_score_adj so the Linux OOM killer will |
182 // prefer to kill certain process types over others. The range for the | 184 // prefer to kill certain process types over others. The range for the |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 // instance running inside the parent. The parent's Breakpad instance should | 776 // instance running inside the parent. The parent's Breakpad instance should |
775 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 777 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
776 // in the child after forking will restore the standard exception handler. | 778 // in the child after forking will restore the standard exception handler. |
777 // See http://crbug.com/20371/ for more details. | 779 // See http://crbug.com/20371/ for more details. |
778 void RestoreDefaultExceptionHandler(); | 780 void RestoreDefaultExceptionHandler(); |
779 #endif // defined(OS_MACOSX) | 781 #endif // defined(OS_MACOSX) |
780 | 782 |
781 } // namespace base | 783 } // namespace base |
782 | 784 |
783 #endif // BASE_PROCESS_UTIL_H_ | 785 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |