| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 # pylint: disable=W0212 | 5 # pylint: disable=W0212 |
| 6 | 6 |
| 7 import fcntl | 7 import fcntl |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import psutil | 10 import psutil |
| 11 | 11 |
| 12 from pylib import cmd_helper | 12 from devil.utils import cmd_helper |
| 13 from pylib import constants | 13 from pylib import constants |
| 14 from pylib import valgrind_tools | 14 from pylib import valgrind_tools |
| 15 | 15 |
| 16 import pylib.device.device_utils | |
| 17 | |
| 18 | 16 |
| 19 def _GetProcessStartTime(pid): | 17 def _GetProcessStartTime(pid): |
| 20 return psutil.Process(pid).create_time | 18 return psutil.Process(pid).create_time |
| 21 | 19 |
| 22 | 20 |
| 23 class _FileLock(object): | 21 class _FileLock(object): |
| 24 """With statement-aware implementation of a file lock. | 22 """With statement-aware implementation of a file lock. |
| 25 | 23 |
| 26 File locks are needed for cross-process synchronization when the | 24 File locks are needed for cross-process synchronization when the |
| 27 multiprocessing Python module is used. | 25 multiprocessing Python module is used. |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 logging.info('Killing device_forwarder.') | 316 logging.info('Killing device_forwarder.') |
| 319 Forwarder._instance._initialized_devices.discard(str(device)) | 317 Forwarder._instance._initialized_devices.discard(str(device)) |
| 320 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH): | 318 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH): |
| 321 return | 319 return |
| 322 | 320 |
| 323 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(), | 321 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(), |
| 324 Forwarder._DEVICE_FORWARDER_PATH) | 322 Forwarder._DEVICE_FORWARDER_PATH) |
| 325 device.RunShellCommand( | 323 device.RunShellCommand( |
| 326 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}, | 324 cmd, env={'LD_LIBRARY_PATH': Forwarder._DEVICE_FORWARDER_FOLDER}, |
| 327 check_return=True) | 325 check_return=True) |
| OLD | NEW |