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

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

Issue 338233003: Telemetry: Set scaling governor on all cpus (on all devices) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 self._log_file = tempfile.TemporaryFile() 51 self._log_file = tempfile.TemporaryFile()
52 52
53 device_param = (['-s', self._device.old_interface.GetDevice()] 53 device_param = (['-s', self._device.old_interface.GetDevice()]
54 if self._device.old_interface.GetDevice() else []) 54 if self._device.old_interface.GetDevice() else [])
55 cmd = ['adb'] + device_param + \ 55 cmd = ['adb'] + device_param + \
56 ['shell', perf_binary, 'record', 56 ['shell', perf_binary, 'record',
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.ForceAllCpusOnline(True) 61 self._perf_control.SetHighPerfMode(True)
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 perf_pids = self._device.old_interface.ExtractPid('perf')
68 self._device.old_interface.RunShellCommand( 68 self._device.old_interface.RunShellCommand(
69 'kill -SIGINT ' + ' '.join(perf_pids)) 69 'kill -SIGINT ' + ' '.join(perf_pids))
70 self._perf_process.wait() 70 self._perf_process.wait()
71 self._perf_control.ForceAllCpusOnline(False) 71 self._perf_control.SetDefaultPerfMode()
72 72
73 def _FailWithLog(self, msg): 73 def _FailWithLog(self, msg):
74 self._log_file.seek(0) 74 self._log_file.seek(0)
75 log = self._log_file.read() 75 log = self._log_file.read()
76 raise RuntimeError('%s. Log output:\n%s' % (msg, log)) 76 raise RuntimeError('%s. Log output:\n%s' % (msg, log))
77 77
78 def PullResult(self, output_path): 78 def PullResult(self, output_path):
79 if not self._device.old_interface.FileExistsOnDevice( 79 if not self._device.old_interface.FileExistsOnDevice(
80 self._output_file.name): 80 self._output_file.name):
81 self._FailWithLog('Perf recorded no data') 81 self._FailWithLog('Perf recorded no data')
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 open(json_file_name, 'w') as json_file: 182 open(json_file_name, 'w') as json_file:
183 cmd = [perfhost_path, 'script', '-s', perf_script_path, '-i', 183 cmd = [perfhost_path, 'script', '-s', perf_script_path, '-i',
184 perf_profile, '--symfs', symfs_dir, '--kallsyms', kallsyms] 184 perf_profile, '--symfs', symfs_dir, '--kallsyms', kallsyms]
185 if subprocess.call(cmd, stdout=json_file, stderr=dev_null): 185 if subprocess.call(cmd, stdout=json_file, stderr=dev_null):
186 logging.warning('Perf data to JSON conversion failed. The result will ' 186 logging.warning('Perf data to JSON conversion failed. The result will '
187 'not contain any perf samples. You can still view the ' 187 'not contain any perf samples. You can still view the '
188 'perf data manually as shown above.') 188 'perf data manually as shown above.')
189 return None 189 return None
190 190
191 return json_file_name 191 return json_file_name
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698