diff options
author | perezju <perezju@chromium.org> | 2014-08-28 10:07:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-28 17:08:44 +0000 |
commit | 4bda9f96e6edbc4c208abde787c842f828f2f798 (patch) | |
tree | 83b1f87c78206e206a833352d00a6decaffbc9c5 /build/android/pylib | |
parent | fd03370152e9020155b53ac3d381303b78b20486 (diff) | |
download | chromium_src-4bda9f96e6edbc4c208abde787c842f828f2f798.zip chromium_src-4bda9f96e6edbc4c208abde787c842f828f2f798.tar.gz chromium_src-4bda9f96e6edbc4c208abde787c842f828f2f798.tar.bz2 |
Make single shell call in _SetScalingGovernorInternal
Changed implementation to make a single shell call, rather than
pushing files and executing several shell calls.
When running telemetry unittests on android, reduces total execution
time about 12%.
BUG=379378
Review URL: https://codereview.chromium.org/514123005
Cr-Commit-Position: refs/heads/master@{#292405}
Diffstat (limited to 'build/android/pylib')
-rw-r--r-- | build/android/pylib/perf/perf_control.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/build/android/pylib/perf/perf_control.py b/build/android/pylib/perf/perf_control.py index 7038907..f4ce855 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): |