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): |