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 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 def IsAosp(self): | 146 def IsAosp(self): |
147 description = self._device.GetProp('ro.build.description', cache=True) | 147 description = self._device.GetProp('ro.build.description', cache=True) |
148 if description is not None: | 148 if description is not None: |
149 return 'aosp' in description | 149 return 'aosp' in description |
150 return False | 150 return False |
151 | 151 |
152 | 152 |
153 def GetRemotePort(self, port): | 153 def GetRemotePort(self, port): |
154 return forwarder.Forwarder.DevicePortForHostPort(port) or 0 | 154 return forwarder.Forwarder.DevicePortForHostPort(port) or 0 |
155 | 155 |
| 156 def CreatePortForwarder(self, port_pair, use_remote_port_forwarding): |
| 157 # use_remote_port_forwarding is ignored as it is always true for |
| 158 # Android device. |
| 159 return self.forwarder_factory.Create(port_pair) |
| 160 |
| 161 def IsDeviceRemote(self): |
| 162 # Android device is connected via adb which is on remote. |
| 163 return True |
| 164 |
156 def IsDisplayTracingSupported(self): | 165 def IsDisplayTracingSupported(self): |
157 return bool(self.GetOSVersionName() >= 'J') | 166 return bool(self.GetOSVersionName() >= 'J') |
158 | 167 |
159 def StartDisplayTracing(self): | 168 def StartDisplayTracing(self): |
160 assert not self._surface_stats_collector | 169 assert not self._surface_stats_collector |
161 # Clear any leftover data from previous timed out tests | 170 # Clear any leftover data from previous timed out tests |
162 self._raw_display_frame_rate_measurements = [] | 171 self._raw_display_frame_rate_measurements = [] |
163 self._surface_stats_collector = \ | 172 self._surface_stats_collector = \ |
164 surface_stats_collector.SurfaceStatsCollector(self._device) | 173 surface_stats_collector.SurfaceStatsCollector(self._device) |
165 self._surface_stats_collector.Start() | 174 self._surface_stats_collector.Start() |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 for process in psutil.process_iter(): | 829 for process in psutil.process_iter(): |
821 try: | 830 try: |
822 if psutil.version_info >= (2, 0): | 831 if psutil.version_info >= (2, 0): |
823 if 'adb' in process.name(): | 832 if 'adb' in process.name(): |
824 process.cpu_affinity([0]) | 833 process.cpu_affinity([0]) |
825 else: | 834 else: |
826 if 'adb' in process.name: | 835 if 'adb' in process.name: |
827 process.set_cpu_affinity([0]) | 836 process.set_cpu_affinity([0]) |
828 except (psutil.NoSuchProcess, psutil.AccessDenied): | 837 except (psutil.NoSuchProcess, psutil.AccessDenied): |
829 logging.warn('Failed to set adb process CPU affinity') | 838 logging.warn('Failed to set adb process CPU affinity') |
OLD | NEW |