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

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

Issue 514123005: Make single shell call in _SetScalingGovernorInternal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 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 70389071a6b46037f23e7c891af7045486e0ef57..f4ce855aadff35d25050ac392ba0136d7735ccbd 100644
--- a/build/android/pylib/perf/perf_control.py
+++ b/build/android/pylib/perf/perf_control.py
@@ -68,12 +68,13 @@ class PerfControl(object):
self._ForceAllCpusOnline(False)
def _SetScalingGovernorInternal(self, value):
- for cpu in range(self._num_cpu_cores):
- scaling_governor_file = PerfControl._SCALING_GOVERNOR_FMT % cpu
- if self._device.FileExists(scaling_governor_file):
- logging.info('Writing scaling governor mode \'%s\' -> %s',
- value, scaling_governor_file)
- self._device.WriteFile(scaling_governor_file, value, as_root=True)
+ 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_governor"\n'
+ ' test -e $FILE && echo %s > $FILE\n'
+ 'done\n') % (cpu_cores, value)
+ logging.info('Setting scaling governor mode: %s', value)
+ self._device.RunShellCommand(script, as_root=True)
def _AllCpusAreOnline(self):
for cpu in range(self._num_cpu_cores):
« 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