OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 #ifdef OS_WIN | 13 #ifdef OS_WIN |
14 #include <windows.h> | 14 #include <windows.h> |
15 #include <tlhelp32.h> | 15 #include <tlhelp32.h> |
16 #endif | 16 #endif |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 #include "base/process.h" | 20 #include "base/process.h" |
21 | 21 |
22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
23 typedef PROCESSENTRY32 ProcessEntry; | 23 typedef PROCESSENTRY32 ProcessEntry; |
24 typedef IO_COUNTERS IoCounters; | 24 typedef IO_COUNTERS IoCounters; |
25 #elif defined(OS_POSIX) | 25 #elif defined(OS_POSIX) |
26 typedef int ProcessEntry; | 26 typedef int ProcessEntry; |
27 typedef int IoCounters; //TODO(awalker): replace with struct when available | 27 struct IoCounters { |
| 28 unsigned long long ReadOperationCount; |
| 29 unsigned long long WriteOperationCount; |
| 30 unsigned long long OtherOperationCount; |
| 31 unsigned long long ReadTransferCount; |
| 32 unsigned long long WriteTransferCount; |
| 33 unsigned long long OtherTransferCount; |
| 34 }; |
28 #endif | 35 #endif |
29 | 36 |
30 namespace process_util { | 37 namespace process_util { |
31 | 38 |
32 // Returns the id of the current process. | 39 // Returns the id of the current process. |
33 int GetCurrentProcId(); | 40 int GetCurrentProcId(); |
34 | 41 |
35 // Returns the ProcessHandle of the current process. | 42 // Returns the ProcessHandle of the current process. |
36 ProcessHandle GetCurrentProcessHandle(); | 43 ProcessHandle GetCurrentProcessHandle(); |
37 | 44 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 269 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
263 void EnableTerminationOnHeapCorruption(); | 270 void EnableTerminationOnHeapCorruption(); |
264 | 271 |
265 // If supported on the platform, and the user has sufficent rights, increase | 272 // If supported on the platform, and the user has sufficent rights, increase |
266 // the current process's scheduling priority to a high priority. | 273 // the current process's scheduling priority to a high priority. |
267 void RaiseProcessToHighPriority(); | 274 void RaiseProcessToHighPriority(); |
268 | 275 |
269 } // namespace process_util | 276 } // namespace process_util |
270 | 277 |
271 #endif // BASE_PROCESS_UTIL_H_ | 278 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |