| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import posixpath | 7 import posixpath |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 import tempfile | 10 import tempfile |
| 11 | 11 |
| 12 from battor import battor_wrapper | 12 from battor import battor_wrapper |
| 13 from telemetry.core import android_platform | 13 from telemetry.core import android_platform |
| 14 from telemetry.core import exceptions | 14 from telemetry.core import exceptions |
| 15 from telemetry.core import util | 15 from telemetry.core import util |
| 16 from telemetry import decorators | 16 from telemetry import decorators |
| 17 from telemetry.internal import forwarders |
| 17 from telemetry.internal.forwarders import android_forwarder | 18 from telemetry.internal.forwarders import android_forwarder |
| 18 from telemetry.internal.image_processing import video | 19 from telemetry.internal.image_processing import video |
| 19 from telemetry.internal.platform import android_device | 20 from telemetry.internal.platform import android_device |
| 20 from telemetry.internal.platform import linux_based_platform_backend | 21 from telemetry.internal.platform import linux_based_platform_backend |
| 21 from telemetry.internal.platform.power_monitor import android_dumpsys_power_moni
tor | 22 from telemetry.internal.platform.power_monitor import android_dumpsys_power_moni
tor |
| 22 from telemetry.internal.platform.power_monitor import android_fuelgauge_power_mo
nitor | 23 from telemetry.internal.platform.power_monitor import android_fuelgauge_power_mo
nitor |
| 23 from telemetry.internal.platform.power_monitor import android_temperature_monito
r | 24 from telemetry.internal.platform.power_monitor import android_temperature_monito
r |
| 24 from telemetry.internal.platform.power_monitor import monsoon_power_monitor | 25 from telemetry.internal.platform.power_monitor import monsoon_power_monitor |
| 25 from telemetry.internal.platform.power_monitor import ( | 26 from telemetry.internal.platform.power_monitor import ( |
| 26 android_power_monitor_controller) | 27 android_power_monitor_controller) |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 577 |
| 577 def _EfficientDeviceDirectoryCopy(self, source, dest): | 578 def _EfficientDeviceDirectoryCopy(self, source, dest): |
| 578 if not self._device_copy_script: | 579 if not self._device_copy_script: |
| 579 self._device.adb.Push( | 580 self._device.adb.Push( |
| 580 _DEVICE_COPY_SCRIPT_FILE, | 581 _DEVICE_COPY_SCRIPT_FILE, |
| 581 _DEVICE_COPY_SCRIPT_LOCATION) | 582 _DEVICE_COPY_SCRIPT_LOCATION) |
| 582 self._device_copy_script = _DEVICE_COPY_SCRIPT_FILE | 583 self._device_copy_script = _DEVICE_COPY_SCRIPT_FILE |
| 583 self._device.RunShellCommand( | 584 self._device.RunShellCommand( |
| 584 ['sh', self._device_copy_script, source, dest]) | 585 ['sh', self._device_copy_script, source, dest]) |
| 585 | 586 |
| 587 def GetPortPairForForwarding(self, local_port): |
| 588 return forwarders.PortPair(local_port=local_port, remote_port=0) |
| 589 |
| 586 def RemoveProfile(self, package, ignore_list): | 590 def RemoveProfile(self, package, ignore_list): |
| 587 """Delete application profile on device. | 591 """Delete application profile on device. |
| 588 | 592 |
| 589 Args: | 593 Args: |
| 590 package: The full package name string of the application for which the | 594 package: The full package name string of the application for which the |
| 591 profile is to be deleted. | 595 profile is to be deleted. |
| 592 ignore_list: List of files to keep. | 596 ignore_list: List of files to keep. |
| 593 """ | 597 """ |
| 594 profile_dir = self._GetProfileDir(package) | 598 profile_dir = self._GetProfileDir(package) |
| 595 if not self._device.PathExists(profile_dir): | 599 if not self._device.PathExists(profile_dir): |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 for process in psutil.process_iter(): | 760 for process in psutil.process_iter(): |
| 757 try: | 761 try: |
| 758 if psutil.version_info >= (2, 0): | 762 if psutil.version_info >= (2, 0): |
| 759 if 'adb' in process.name(): | 763 if 'adb' in process.name(): |
| 760 process.cpu_affinity([0]) | 764 process.cpu_affinity([0]) |
| 761 else: | 765 else: |
| 762 if 'adb' in process.name: | 766 if 'adb' in process.name: |
| 763 process.set_cpu_affinity([0]) | 767 process.set_cpu_affinity([0]) |
| 764 except (psutil.NoSuchProcess, psutil.AccessDenied): | 768 except (psutil.NoSuchProcess, psutil.AccessDenied): |
| 765 logging.warn('Failed to set adb process CPU affinity') | 769 logging.warn('Failed to set adb process CPU affinity') |
| OLD | NEW |