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

Unified Diff: build/android/pylib/perf/perf_control.py

Issue 652343002: Telemetry: Pin Nexus 5 cores online. Limit CPU & GPU frequency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/perf/perf_control.py
diff --git a/build/android/pylib/perf/perf_control.py b/build/android/pylib/perf/perf_control.py
index d90edf45fc92779b183fa80d1c924cc0a757f051..ede131789d70faca081d3810e5ccafb659adfb07 100644
--- a/build/android/pylib/perf/perf_control.py
+++ b/build/android/pylib/perf/perf_control.py
@@ -28,7 +28,7 @@ class PerfControl(object):
self._have_mpdecision = self._device.FileExists('/system/bin/mpdecision')
def SetHighPerfMode(self):
- """Sets the highest possible performance mode for the device."""
+ """Sets the highest stable performance mode for the device."""
if not self._device.old_interface.IsRootEnabled():
message = 'Need root for performance mode. Results may be NOISY!!'
logging.warning(message)
@@ -36,12 +36,23 @@ class PerfControl(object):
# may be different/noisy (due to the lack of intended performance mode).
atexit.register(logging.warning, message)
return
+
+ product_model = self._device.old_interface.GetProductModel()
# TODO(epenner): Enable on all devices (http://crbug.com/383566)
- if 'Nexus 4' == self._device.old_interface.GetProductModel():
+ if 'Nexus 4' == product_model:
self._ForceAllCpusOnline(True)
if not self._AllCpusAreOnline():
logging.warning('Failed to force CPUs online. Results may be NOISY!')
- self._SetScalingGovernorInternal('performance')
+ self._SetScalingGovernorInternal('performance')
+ elif 'Nexus 5' == product_model:
+ self._ForceAllCpusOnline(True)
+ if not self._AllCpusAreOnline():
+ logging.warning('Failed to force CPUs online. Results may be NOISY!')
+ self._SetScalingGovernorInternal('performance')
+ self._SetScalingMaxFreq(1190400)
+ self._SetMaxGpuClock(200000000)
+ else:
+ self._SetScalingGovernorInternal('performance')
def SetPerfProfilingMode(self):
"""Enables all cores for reliable perf profiling."""
@@ -56,11 +67,17 @@ class PerfControl(object):
"""Sets the performance mode for the device to its default mode."""
if not self._device.old_interface.IsRootEnabled():
return
- product_model = self._device.GetProp('ro.product.model')
+ product_model = self._device.old_interface.GetProductModel()
+ if 'Nexus 5' == product_model:
+ if self._AllCpusAreOnline():
+ self._SetScalingMaxFreq(2265600)
+ self._SetMaxGpuClock(450000000)
+
governor_mode = {
'GT-I9300': 'pegasusq',
'Galaxy Nexus': 'interactive',
'Nexus 4': 'ondemand',
+ 'Nexus 5': 'ondemand',
'Nexus 7': 'interactive',
'Nexus 10': 'interactive'
}.get(product_model, 'ondemand')
@@ -76,6 +93,19 @@ class PerfControl(object):
logging.info('Setting scaling governor mode: %s', value)
self._device.RunShellCommand(script, as_root=True)
+ def _SetScalingMaxFreq(self, value):
+ cpu_cores = ' '.join([str(x) for x in range(self._num_cpu_cores)])
+ script = ('for CPU in %s; do\n'
+ ' FILE="/sys/devices/system/cpu/cpu$CPU/cpufreq/scaling_max_freq"\n'
+ ' test -e $FILE && echo %d > $FILE\n'
+ 'done\n') % (cpu_cores, value)
+ self._device.RunShellCommand(script, as_root=True)
+
+ def _SetMaxGpuClock(self, value):
+ self._device.WriteFile('/sys/class/kgsl/kgsl-3d0/max_gpuclk',
+ str(value),
+ as_root=True)
+
def _AllCpusAreOnline(self):
for cpu in range(1, self._num_cpu_cores):
online_path = PerfControl._CPU_ONLINE_FMT % cpu
@@ -113,3 +143,4 @@ class PerfControl(object):
for cpu in range(self._num_cpu_cores):
online_path = PerfControl._CPU_ONLINE_FMT % cpu
self._device.WriteFile(online_path, '1', as_root=True)
+
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698