Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3069)

Unified Diff: build/android/pylib/perf_tests_helper.py

Issue 11938002: Android: fix cpu governor setup for perf tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix random changes in perf test results - code review revision Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/perf_tests_helper.py
diff --git a/build/android/pylib/perf_tests_helper.py b/build/android/pylib/perf_tests_helper.py
index bec92a20d2a1bcb308322ba658d08b5c7e304692..40bdf7edc5da5f7703bf49cb6bbaf65bde851f7c 100644
--- a/build/android/pylib/perf_tests_helper.py
+++ b/build/android/pylib/perf_tests_helper.py
@@ -126,14 +126,15 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default',
class PerfTestSetup(object):
"""Provides methods for setting up a device for perf testing."""
_DROP_CACHES = '/proc/sys/vm/drop_caches'
- _SCALING_GOVERNOR = '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor'
+ _SCALING_GOVERNOR_FMT = (
+ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor')
def __init__(self, adb):
self._adb = adb
- num_cpus = self._adb.GetFileContents('/sys/devices/system/cpu/online',
+ kernel_max = self._adb.GetFileContents('/sys/devices/system/cpu/kernel_max',
log_result=False)
- assert num_cpus, 'Unable to find /sys/devices/system/cpu/online'
- self._num_cpus = int(num_cpus[0].split('-')[-1])
+ assert kernel_max, 'Unable to find /sys/devices/system/cpu/kernel_max'
+ self._kernel_max = int(kernel_max[0])
self._original_scaling_governor = None
def DropRamCaches(self):
@@ -147,7 +148,7 @@ class PerfTestSetup(object):
"""Sets up performance tests."""
if not self._original_scaling_governor:
self._original_scaling_governor = self._adb.GetFileContents(
- PerfTestSetup._SCALING_GOVERNOR % 0,
+ PerfTestSetup._SCALING_GOVERNOR_FMT % 0,
log_result=False)[0]
self._SetScalingGovernorInternal('performance')
self.DropRamCaches()
@@ -159,6 +160,8 @@ class PerfTestSetup(object):
self._original_scaling_governor = None
def _SetScalingGovernorInternal(self, value):
- for cpu in range(self._num_cpus):
- self._adb.RunShellCommand(
- ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu))
+ for cpu in range(self._kernel_max + 1):
+ scaling_governor_file = PerfTestSetup._SCALING_GOVERNOR_FMT % cpu
+ if self._adb.Adb().DoesFileExist(scaling_governor_file):
+ self._adb.RunShellCommand(
+ ('echo %s > ' + scaling_governor_file) % value)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698