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

Side by Side Diff: build/android/pylib/perf/perf_control.py

Issue 1261763004: Remove handling code for android_command in pylib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove 2 more TODO comments Created 5 years, 4 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 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 atexit 5 import atexit
6 import logging 6 import logging
7 7
8 from pylib import android_commands
9 from pylib.device import device_errors 8 from pylib.device import device_errors
10 from pylib.device import device_utils 9 from pylib.device import device_utils
11 10
12 11
13 class PerfControl(object): 12 class PerfControl(object):
14 """Provides methods for setting the performance mode of a device.""" 13 """Provides methods for setting the performance mode of a device."""
15 _CPU_PATH = '/sys/devices/system/cpu' 14 _CPU_PATH = '/sys/devices/system/cpu'
16 _KERNEL_MAX = '/sys/devices/system/cpu/kernel_max' 15 _KERNEL_MAX = '/sys/devices/system/cpu/kernel_max'
17 16
18 def __init__(self, device): 17 def __init__(self, device):
19 # TODO(jbudorick) Remove once telemetry gets switched over.
20 assert not isinstance(device, android_commands.AndroidCommands)
21 self._device = device 18 self._device = device
22 # this will raise an AdbCommandFailedError if no CPU files are found 19 # this will raise an AdbCommandFailedError if no CPU files are found
23 self._cpu_files = self._device.RunShellCommand( 20 self._cpu_files = self._device.RunShellCommand(
24 'ls -d cpu[0-9]*', cwd=self._CPU_PATH, check_return=True, as_root=True) 21 'ls -d cpu[0-9]*', cwd=self._CPU_PATH, check_return=True, as_root=True)
25 assert self._cpu_files, 'Failed to detect CPUs.' 22 assert self._cpu_files, 'Failed to detect CPUs.'
26 self._cpu_file_list = ' '.join(self._cpu_files) 23 self._cpu_file_list = ' '.join(self._cpu_files)
27 logging.info('CPUs found: %s', self._cpu_file_list) 24 logging.info('CPUs found: %s', self._cpu_file_list)
28 self._have_mpdecision = self._device.FileExists('/system/bin/mpdecision') 25 self._have_mpdecision = self._device.FileExists('/system/bin/mpdecision')
29 26
30 def SetHighPerfMode(self): 27 def SetHighPerfMode(self):
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 """ 148 """
152 if self._have_mpdecision: 149 if self._have_mpdecision:
153 script = 'stop mpdecision' if force_online else 'start mpdecision' 150 script = 'stop mpdecision' if force_online else 'start mpdecision'
154 self._device.RunShellCommand(script, check_return=True, as_root=True) 151 self._device.RunShellCommand(script, check_return=True, as_root=True)
155 152
156 if not self._have_mpdecision and not self._AllCpusAreOnline(): 153 if not self._have_mpdecision and not self._AllCpusAreOnline():
157 logging.warning('Unexpected cpu hot plugging detected.') 154 logging.warning('Unexpected cpu hot plugging detected.')
158 155
159 if force_online: 156 if force_online:
160 self._ForEachCpu('echo 1 > "$CPU/online"') 157 self._ForEachCpu('echo 1 > "$CPU/online"')
OLDNEW
« no previous file with comments | « build/android/pylib/perf/cache_control.py ('k') | build/android/pylib/perf/surface_stats_collector.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698