| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <ctype.h> | 7 #include <ctype.h> |
| 8 #include <dirent.h> | 8 #include <dirent.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 int status; | 268 int status; |
| 269 waitpid(handle, &status, 0); | 269 waitpid(handle, &status, 0); |
| 270 return WIFEXITED(status); | 270 return WIFEXITED(status); |
| 271 } | 271 } |
| 272 | 272 |
| 273 bool CleanupProcesses(const std::wstring& executable_name, | 273 bool CleanupProcesses(const std::wstring& executable_name, |
| 274 int wait_milliseconds, | 274 int wait_milliseconds, |
| 275 int exit_code, | 275 int exit_code, |
| 276 const ProcessFilter* filter) { | 276 const ProcessFilter* filter) { |
| 277 bool exited_cleanly = | 277 bool exited_cleanly = |
| 278 process_util::WaitForProcessesToExit(executable_name, wait_milliseconds, | 278 WaitForProcessesToExit(executable_name, wait_milliseconds, |
| 279 filter); | 279 filter); |
| 280 if (!exited_cleanly) | 280 if (!exited_cleanly) |
| 281 process_util::KillProcesses(executable_name, exit_code, filter); | 281 KillProcesses(executable_name, exit_code, filter); |
| 282 return exited_cleanly; | 282 return exited_cleanly; |
| 283 } | 283 } |
| 284 | 284 |
| 285 /////////////////////////////////////////////////////////////////////////////// | 285 /////////////////////////////////////////////////////////////////////////////// |
| 286 //// ProcessMetrics | 286 //// ProcessMetrics |
| 287 | 287 |
| 288 // To have /proc/self/io file you must enable CONFIG_TASK_IO_ACCOUNTING | 288 // To have /proc/self/io file you must enable CONFIG_TASK_IO_ACCOUNTING |
| 289 // in your kernel configuration. | 289 // in your kernel configuration. |
| 290 bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) { | 290 bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) { |
| 291 std::string proc_io_contents; | 291 std::string proc_io_contents; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 321 } | 321 } |
| 322 return true; | 322 return true; |
| 323 } | 323 } |
| 324 | 324 |
| 325 int ProcessMetrics::GetCPUUsage() { | 325 int ProcessMetrics::GetCPUUsage() { |
| 326 // TODO(port): This needs to be replaced by an call to getrusage(). | 326 // TODO(port): This needs to be replaced by an call to getrusage(). |
| 327 return -1; | 327 return -1; |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace base | 330 } // namespace base |
| OLD | NEW |