| OLD | NEW | 
|    1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2009 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 #if defined(OS_WIN) |   13 #if defined(OS_WIN) | 
|   14 #include <windows.h> |   14 #include <windows.h> | 
|   15 #include <tlhelp32.h> |   15 #include <tlhelp32.h> | 
|   16 #elif defined(OS_LINUX) |   16 #elif defined(OS_MACOSX) | 
 |   17 // kinfo_proc is defined in <sys/sysctl.h>, but this forward declaration | 
 |   18 // is sufficient for the vector<> below. | 
 |   19 struct kinfo_proc; | 
 |   20 #elif defined(OS_POSIX) | 
|   17 #include <dirent.h> |   21 #include <dirent.h> | 
|   18 #include <limits.h> |   22 #include <limits.h> | 
|   19 #include <sys/types.h> |   23 #include <sys/types.h> | 
|   20 #endif |   24 #endif | 
|   21  |   25  | 
|   22 #include <string> |   26 #include <string> | 
|   23 #include <utility> |   27 #include <utility> | 
|   24 #include <vector> |   28 #include <vector> | 
|   25  |   29  | 
|   26 #include "base/command_line.h" |   30 #include "base/command_line.h" | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|   43   unsigned long long WriteOperationCount; |   47   unsigned long long WriteOperationCount; | 
|   44   unsigned long long OtherOperationCount; |   48   unsigned long long OtherOperationCount; | 
|   45   unsigned long long ReadTransferCount; |   49   unsigned long long ReadTransferCount; | 
|   46   unsigned long long WriteTransferCount; |   50   unsigned long long WriteTransferCount; | 
|   47   unsigned long long OtherTransferCount; |   51   unsigned long long OtherTransferCount; | 
|   48 }; |   52 }; | 
|   49  |   53  | 
|   50 #include "base/file_descriptor_shuffle.h" |   54 #include "base/file_descriptor_shuffle.h" | 
|   51 #endif |   55 #endif | 
|   52  |   56  | 
|   53 #if defined(OS_MACOSX) |  | 
|   54 struct kinfo_proc; |  | 
|   55 #endif |  | 
|   56  |  | 
|   57 namespace base { |   57 namespace base { | 
|   58  |   58  | 
|   59 // A minimalistic but hopefully cross-platform set of exit codes. |   59 // A minimalistic but hopefully cross-platform set of exit codes. | 
|   60 // Do not change the enumeration values or you will break third-party |   60 // Do not change the enumeration values or you will break third-party | 
|   61 // installers. |   61 // installers. | 
|   62 enum { |   62 enum { | 
|   63   PROCESS_END_NORMAL_TERMINATON = 0, |   63   PROCESS_END_NORMAL_TERMINATON = 0, | 
|   64   PROCESS_END_KILLED_BY_USER    = 1, |   64   PROCESS_END_KILLED_BY_USER    = 1, | 
|   65   PROCESS_END_PROCESS_WAS_HUNG  = 2 |   65   PROCESS_END_PROCESS_WAS_HUNG  = 2 | 
|   66 }; |   66 }; | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  266  |  266  | 
|  267   // Initializes a PROCESSENTRY32 data structure so that it's ready for |  267   // Initializes a PROCESSENTRY32 data structure so that it's ready for | 
|  268   // use with Process32First/Process32Next. |  268   // use with Process32First/Process32Next. | 
|  269   void InitProcessEntry(ProcessEntry* entry); |  269   void InitProcessEntry(ProcessEntry* entry); | 
|  270  |  270  | 
|  271   std::wstring executable_name_; |  271   std::wstring executable_name_; | 
|  272  |  272  | 
|  273 #if defined(OS_WIN) |  273 #if defined(OS_WIN) | 
|  274   HANDLE snapshot_; |  274   HANDLE snapshot_; | 
|  275   bool started_iteration_; |  275   bool started_iteration_; | 
|  276 #elif defined(OS_LINUX) |  | 
|  277   DIR *procfs_dir_; |  | 
|  278 #elif defined(OS_MACOSX) |  276 #elif defined(OS_MACOSX) | 
|  279   std::vector<kinfo_proc> kinfo_procs_; |  277   std::vector<kinfo_proc> kinfo_procs_; | 
|  280   size_t index_of_kinfo_proc_; |  278   size_t index_of_kinfo_proc_; | 
 |  279 #elif defined(OS_POSIX) | 
 |  280   DIR *procfs_dir_; | 
|  281 #endif |  281 #endif | 
|  282   ProcessEntry entry_; |  282   ProcessEntry entry_; | 
|  283   const ProcessFilter* filter_; |  283   const ProcessFilter* filter_; | 
|  284  |  284  | 
|  285   DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator); |  285   DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator); | 
|  286 }; |  286 }; | 
|  287  |  287  | 
|  288 // Working Set (resident) memory usage broken down by |  288 // Working Set (resident) memory usage broken down by | 
|  289 // priv (private): These pages (kbytes) cannot be shared with any other process. |  289 // priv (private): These pages (kbytes) cannot be shared with any other process. | 
|  290 // shareable:      These pages (kbytes) can be shared with other processes under |  290 // shareable:      These pages (kbytes) can be shared with other processes under | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  401 // overflow. Has no effect if the OS doesn't provide the necessary facility. |  401 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 
|  402 void EnableTerminationOnHeapCorruption(); |  402 void EnableTerminationOnHeapCorruption(); | 
|  403  |  403  | 
|  404 // If supported on the platform, and the user has sufficent rights, increase |  404 // If supported on the platform, and the user has sufficent rights, increase | 
|  405 // the current process's scheduling priority to a high priority. |  405 // the current process's scheduling priority to a high priority. | 
|  406 void RaiseProcessToHighPriority(); |  406 void RaiseProcessToHighPriority(); | 
|  407  |  407  | 
|  408 }  // namespace base |  408 }  // namespace base | 
|  409  |  409  | 
|  410 #endif  // BASE_PROCESS_UTIL_H_ |  410 #endif  // BASE_PROCESS_UTIL_H_ | 
| OLD | NEW |