Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: tools/android/adb_profile_chrome/perf_controller.py

Issue 386053002: [Android] Switch to DeviceUtils versions of GetPid, TakeScreenshot, and GetIoStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 subprocess 7 import subprocess
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 '--output', self._output_file.name] + _PERF_OPTIONS 57 '--output', self._output_file.name] + _PERF_OPTIONS
58 if categories: 58 if categories:
59 cmd += ['--event', ','.join(categories)] 59 cmd += ['--event', ','.join(categories)]
60 self._perf_control = perf_control.PerfControl(self._device) 60 self._perf_control = perf_control.PerfControl(self._device)
61 self._perf_control.SetPerfProfilingMode() 61 self._perf_control.SetPerfProfilingMode()
62 self._perf_process = subprocess.Popen(cmd, 62 self._perf_process = subprocess.Popen(cmd,
63 stdout=self._log_file, 63 stdout=self._log_file,
64 stderr=subprocess.STDOUT) 64 stderr=subprocess.STDOUT)
65 65
66 def SignalAndWait(self): 66 def SignalAndWait(self):
67 perf_pids = self._device.old_interface.ExtractPid('perf') 67 self._device.KillAll('perf', signum=signal.SIGINT)
68 self._device.RunShellCommand('kill -SIGINT ' + ' '.join(perf_pids))
69 self._perf_process.wait() 68 self._perf_process.wait()
70 self._perf_control.SetDefaultPerfMode() 69 self._perf_control.SetDefaultPerfMode()
71 70
72 def _FailWithLog(self, msg): 71 def _FailWithLog(self, msg):
73 self._log_file.seek(0) 72 self._log_file.seek(0)
74 log = self._log_file.read() 73 log = self._log_file.read()
75 raise RuntimeError('%s. Log output:\n%s' % (msg, log)) 74 raise RuntimeError('%s. Log output:\n%s' % (msg, log))
76 75
77 def PullResult(self, output_path): 76 def PullResult(self, output_path):
78 if not self._device.FileExists(self._output_file.name): 77 if not self._device.FileExists(self._output_file.name):
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 open(json_file_name, 'w') as json_file: 178 open(json_file_name, 'w') as json_file:
180 cmd = [perfhost_path, 'script', '-s', perf_script_path, '-i', 179 cmd = [perfhost_path, 'script', '-s', perf_script_path, '-i',
181 perf_profile, '--symfs', symfs_dir, '--kallsyms', kallsyms] 180 perf_profile, '--symfs', symfs_dir, '--kallsyms', kallsyms]
182 if subprocess.call(cmd, stdout=json_file, stderr=dev_null): 181 if subprocess.call(cmd, stdout=json_file, stderr=dev_null):
183 logging.warning('Perf data to JSON conversion failed. The result will ' 182 logging.warning('Perf data to JSON conversion failed. The result will '
184 'not contain any perf samples. You can still view the ' 183 'not contain any perf samples. You can still view the '
185 'perf data manually as shown above.') 184 'perf data manually as shown above.')
186 return None 185 return None
187 186
188 return json_file_name 187 return json_file_name
OLDNEW
« no previous file with comments | « build/android/screenshot.py ('k') | tools/telemetry/telemetry/core/platform/android_platform_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698