diff options
author | Keun Soo Yim <yim@google.com> | 2017-01-03 14:26:23 -0800 |
---|---|---|
committer | Keun Soo Yim <yim@google.com> | 2017-01-05 20:48:13 -0800 |
commit | 0037eb8268605154de2b15119c3687c54a44a987 (patch) | |
tree | 98aab1482851dbfba11599312dc656180bab5c30 /binder_benchmark | |
parent | 2b6f76a082d46c80f8a318292094d98bef20eb94 (diff) | |
download | performance-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 'binder_benchmark')
-rw-r--r-- | binder_benchmark/BinderPerformanceTest.py | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/binder_benchmark/BinderPerformanceTest.py b/binder_benchmark/BinderPerformanceTest.py index eddfd9a..655ca81 100644 --- a/binder_benchmark/BinderPerformanceTest.py +++ b/binder_benchmark/BinderPerformanceTest.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 BinderPerformanceTest(base_test_with_webdb.BaseTestWithWebDbClass): - """A testcase for the Binder Performance Benchmarking.""" + """A testcase for the Binder Performance Benchmarking. + + Attributes: + dut: the target DUT (device under test) instance. + _cpu_freq: CpuFrequencyScalingController instance of self.dut. + """ THRESHOLD = { 32: { @@ -70,39 +76,20 @@ class BinderPerformanceTest(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: string, expected CPU governer mode, e.g., performance/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) |