| 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 #include "base/process_util.h" | 5 #include "base/process_util.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
| 10 #include <sys/time.h> | 10 #include <sys/time.h> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace base { | 23 namespace base { |
| 24 | 24 |
| 25 int GetCurrentProcId() { | 25 int GetCurrentProcId() { |
| 26 return getpid(); | 26 return getpid(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ProcessHandle GetCurrentProcessHandle() { | 29 ProcessHandle GetCurrentProcessHandle() { |
| 30 return GetCurrentProcId(); | 30 return GetCurrentProcId(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 bool CloseProcessHandle(ProcessHandle process) { |
| 34 return true; |
| 35 } |
| 36 |
| 33 int GetProcId(ProcessHandle process) { | 37 int GetProcId(ProcessHandle process) { |
| 34 return process; | 38 return process; |
| 35 } | 39 } |
| 36 | 40 |
| 37 // Attempts to kill the process identified by the given process | 41 // Attempts to kill the process identified by the given process |
| 38 // entry structure. Ignores specified exit_code; posix can't force that. | 42 // entry structure. Ignores specified exit_code; posix can't force that. |
| 39 // Returns true if this is successful, false otherwise. | 43 // Returns true if this is successful, false otherwise. |
| 40 bool KillProcess(int process_id, int exit_code, bool wait) { | 44 bool KillProcess(int process_id, int exit_code, bool wait) { |
| 41 bool result = false; | 45 bool result = false; |
| 42 | 46 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 int cpu = static_cast<int>((system_time_delta * 100 + time_delta / 2) / | 239 int cpu = static_cast<int>((system_time_delta * 100 + time_delta / 2) / |
| 236 time_delta); | 240 time_delta); |
| 237 | 241 |
| 238 last_system_time_ = system_time; | 242 last_system_time_ = system_time; |
| 239 last_time_ = time; | 243 last_time_ = time; |
| 240 | 244 |
| 241 return cpu; | 245 return cpu; |
| 242 } | 246 } |
| 243 | 247 |
| 244 } // namespace base | 248 } // namespace base |
| OLD | NEW |