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 re | 7 import re |
8 import shutil | 8 import shutil |
9 import stat | 9 import stat |
10 import subprocess | 10 import subprocess |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 # Clear any leftover data from previous timed out tests | 221 # Clear any leftover data from previous timed out tests |
222 self._raw_display_frame_rate_measurements = [] | 222 self._raw_display_frame_rate_measurements = [] |
223 self._surface_stats_collector = \ | 223 self._surface_stats_collector = \ |
224 surface_stats_collector.SurfaceStatsCollector(self._device) | 224 surface_stats_collector.SurfaceStatsCollector(self._device) |
225 self._surface_stats_collector.Start() | 225 self._surface_stats_collector.Start() |
226 | 226 |
227 def StopDisplayTracing(self): | 227 def StopDisplayTracing(self): |
228 if not self._surface_stats_collector: | 228 if not self._surface_stats_collector: |
229 return | 229 return |
230 | 230 |
231 refresh_period, timestamps = self._surface_stats_collector.Stop() | 231 try: |
232 pid = self._surface_stats_collector.GetSurfaceFlingerPid() | 232 refresh_period, timestamps = self._surface_stats_collector.Stop() |
233 self._surface_stats_collector = None | 233 pid = self._surface_stats_collector.GetSurfaceFlingerPid() |
| 234 finally: |
| 235 self._surface_stats_collector = None |
234 # TODO(sullivan): should this code be inline, or live elsewhere? | 236 # TODO(sullivan): should this code be inline, or live elsewhere? |
235 events = [] | 237 events = [] |
236 for ts in timestamps: | 238 for ts in timestamps: |
237 events.append({ | 239 events.append({ |
238 'cat': 'SurfaceFlinger', | 240 'cat': 'SurfaceFlinger', |
239 'name': 'vsync_before', | 241 'name': 'vsync_before', |
240 'ts': ts, | 242 'ts': ts, |
241 'pid': pid, | 243 'pid': pid, |
242 'tid': pid, | 244 'tid': pid, |
243 'args': {'data': { | 245 'args': {'data': { |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 for process in psutil.process_iter(): | 852 for process in psutil.process_iter(): |
851 try: | 853 try: |
852 if psutil.version_info >= (2, 0): | 854 if psutil.version_info >= (2, 0): |
853 if 'adb' in process.name(): | 855 if 'adb' in process.name(): |
854 process.cpu_affinity([0]) | 856 process.cpu_affinity([0]) |
855 else: | 857 else: |
856 if 'adb' in process.name: | 858 if 'adb' in process.name: |
857 process.set_cpu_affinity([0]) | 859 process.set_cpu_affinity([0]) |
858 except (psutil.NoSuchProcess, psutil.AccessDenied): | 860 except (psutil.NoSuchProcess, psutil.AccessDenied): |
859 logging.warn('Failed to set adb process CPU affinity') | 861 logging.warn('Failed to set adb process CPU affinity') |
OLD | NEW |