summaryrefslogtreecommitdiff
path: root/hwbinder_benchmark
diff options
context:
space:
mode:
authorKeun Soo Yim <yim@google.com>2017-01-03 14:26:23 -0800
committerKeun Soo Yim <yim@google.com>2017-01-05 20:48:13 -0800
commit0037eb8268605154de2b15119c3687c54a44a987 (patch)
tree98aab1482851dbfba11599312dc656180bab5c30 /hwbinder_benchmark
parent2b6f76a082d46c80f8a318292094d98bef20eb94 (diff)
downloadperformance-0037eb8268605154de2b15119c3687c54a44a987.tar.gz
skip if the actual CPU frequency < theoretical max due to thermal throttling.
Test: make vts -j10 && vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module BinderPerformanceTest -l INFO Change-Id: I90d324f9c08c124a9bc16e5d30ac5f09e18ec745
Diffstat (limited to 'hwbinder_benchmark')
-rw-r--r--hwbinder_benchmark/HwBinderPerformanceTest.py47
1 files changed, 17 insertions, 30 deletions
diff --git a/hwbinder_benchmark/HwBinderPerformanceTest.py b/hwbinder_benchmark/HwBinderPerformanceTest.py
index b89f5d0..de0cfc7 100644
--- a/hwbinder_benchmark/HwBinderPerformanceTest.py
+++ b/hwbinder_benchmark/HwBinderPerformanceTest.py
@@ -19,13 +19,19 @@ import logging
from vts.runners.host import asserts
from vts.runners.host import base_test_with_webdb
+from vts.runners.host import const
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
-from vts.runners.host import const
+from vts.utils.python.cpu import cpu_frequency_scaling
class HwBinderPerformanceTest(base_test_with_webdb.BaseTestWithWebDbClass):
- """A test case for the HWBinder performance benchmarking."""
+ """A test case for the HWBinder performance benchmarking.
+
+ Attributes:
+ dut: the target DUT (device under test) instance.
+ _cpu_freq: CpuFrequencyScalingController instance of self.dut.
+ """
THRESHOLD = {
32: {
@@ -73,39 +79,20 @@ class HwBinderPerformanceTest(base_test_with_webdb.BaseTestWithWebDbClass):
self.dut.shell.InvokeTerminal("one")
self.dut.shell.one.Execute("stop")
self.dut.shell.one.Execute("setprop sys.boot_completed 0")
- self.DisableCpuScaling()
+ self._cpu_freq = cpu_frequency_scaling.CpuFrequencyScalingController(self.dut)
+ self._cpu_freq.DisableCpuScaling()
+
+ def setUpTest(self):
+ self._cpu_freq.SkipIfThermalThrottling(retry_delay_secs=30)
+
+ def tearDownTest(self):
+ self._cpu_freq.SkipIfThermalThrottling()
def tearDownClass(self):
- self.EnableCpuScaling()
+ self._cpu_freq.EnableCpuScaling()
self.dut.shell.one.Execute("start")
self.dut.waitForBootCompletion()
- def ChangeCpuGoverner(self, mode):
- """Changes the cpu governer mode of all the cpus on the device.
-
- Args:
- mode:expected cpu governer mode. e.g performan/interactive.
- """
- results = self.dut.shell.one.Execute(
- "cat /sys/devices/system/cpu/possible")
- asserts.assertEqual(len(results[const.STDOUT]), 1)
- stdout_lines = results[const.STDOUT][0].split("\n")
- (low, high) = stdout_lines[0].split('-')
- logging.info("possible cpus: %s : %s" % (low, high))
-
- for cpu_no in range(int(low), int(high)):
- self.dut.shell.one.Execute(
- "echo %s > /sys/devices/system/cpu/cpu%s/"
- "cpufreq/scaling_governor" % (mode, cpu_no))
-
- def DisableCpuScaling(self):
- """Disable CPU frequency scaling on the device."""
- self.ChangeCpuGoverner("performance")
-
- def EnableCpuScaling(self):
- """Enable CPU frequency scaling on the device."""
- self.ChangeCpuGoverner("interactive")
-
def testRunBenchmark32Bit(self):
"""A testcase which runs the 32-bit benchmark."""
self.RunBenchmark(32)