aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@google.com>2018-05-02 21:14:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-04 03:02:18 -0700
commitc7e0520bf76fdea56408486c92aec51da718331c (patch)
tree83a5f1cdcdc559390c1f7357341c1245076bbb5c
parent065ab805e293e91904ba4d061cb66c6dfe657dad (diff)
downloadtoolchain-utils-c7e0520bf76fdea56408486c92aec51da718331c.tar.gz
crosperf: Disable turbo only if enabled.
Write to no_turbo file only if the field is set to 0. BUG=chromium:839125 TEST=No more errors Change-Id: If5de67606557c21107843837afd035cf32545475 Reviewed-on: https://chromium-review.googlesource.com/1042866 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Caroline Tice <cmtice@chromium.org>
-rw-r--r--crosperf/suite_runner.py5
-rwxr-xr-xcrosperf/suite_runner_unittest.py5
2 files changed, 8 insertions, 2 deletions
diff --git a/crosperf/suite_runner.py b/crosperf/suite_runner.py
index 6a7fa6bd..b4b669a8 100644
--- a/crosperf/suite_runner.py
+++ b/crosperf/suite_runner.py
@@ -90,7 +90,10 @@ class SuiteRunner(object):
'set -e && '
# Disable Turbo in Intel pstate driver
'if [[ -e /sys/devices/system/cpu/intel_pstate/no_turbo ]]; then '
- '(echo -n 1 > /sys/devices/system/cpu/intel_pstate/no_turbo || true); fi; '
+ ' if grep -q 0 /sys/devices/system/cpu/intel_pstate/no_turbo; then '
+ ' echo -n 1 > /sys/devices/system/cpu/intel_pstate/no_turbo; '
+ ' fi; '
+ 'fi; '
# Set governor to performance for each cpu
'for f in /sys/devices/system/cpu/cpu*/cpufreq; do '
'cd $f; '
diff --git a/crosperf/suite_runner_unittest.py b/crosperf/suite_runner_unittest.py
index ed18eb7a..d7b9e770 100755
--- a/crosperf/suite_runner_unittest.py
+++ b/crosperf/suite_runner_unittest.py
@@ -171,7 +171,10 @@ class SuiteRunnerTest(unittest.TestCase):
'set -e && '
# Disable Turbo in Intel pstate driver
'if [[ -e /sys/devices/system/cpu/intel_pstate/no_turbo ]]; then '
- '(echo -n 1 > /sys/devices/system/cpu/intel_pstate/no_turbo || true); fi; '
+ ' if grep -q 0 /sys/devices/system/cpu/intel_pstate/no_turbo; then '
+ ' echo -n 1 > /sys/devices/system/cpu/intel_pstate/no_turbo; '
+ ' fi; '
+ 'fi; '
# Set governor to performance for each cpu
'for f in /sys/devices/system/cpu/cpu*/cpufreq; do '
'cd $f; '