Index: build/android/pylib/perf/perf_control.py |
diff --git a/build/android/pylib/perf/perf_control.py b/build/android/pylib/perf/perf_control.py |
index 6f74575b9e6021fa60fd3d9401d36f05a4fb91c8..70389071a6b46037f23e7c891af7045486e0ef57 100644 |
--- a/build/android/pylib/perf/perf_control.py |
+++ b/build/android/pylib/perf/perf_control.py |
@@ -2,12 +2,12 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import atexit |
import logging |
from pylib import android_commands |
from pylib.device import device_utils |
- |
class PerfControl(object): |
"""Provides methods for setting the performance mode of a device.""" |
_SCALING_GOVERNOR_FMT = ( |
@@ -28,15 +28,23 @@ class PerfControl(object): |
self._have_mpdecision = self._device.FileExists('/system/bin/mpdecision') |
def SetHighPerfMode(self): |
+ """Sets the highest possible performance mode for the device.""" |
+ if not self._device.old_interface.IsRootEnabled(): |
+ message = 'Need root for performance mode. Results may be NOISY!!' |
+ logging.warning(message) |
+ # Add an additional warning at exit, such that it's clear that any results |
+ # may be different/noisy (due to the lack of intended performance mode). |
+ atexit.register(logging.warning, message) |
+ return |
# TODO(epenner): Enable on all devices (http://crbug.com/383566) |
if 'Nexus 4' == self._device.old_interface.GetProductModel(): |
self._ForceAllCpusOnline(True) |
if not self._AllCpusAreOnline(): |
- logging.warning('Failed to force CPUs online. Results may be noisy!') |
+ logging.warning('Failed to force CPUs online. Results may be NOISY!') |
self._SetScalingGovernorInternal('performance') |
def SetPerfProfilingMode(self): |
- """Sets the highest possible performance mode for the device.""" |
+ """Enables all cores for reliable perf profiling.""" |
self._ForceAllCpusOnline(True) |
self._SetScalingGovernorInternal('performance') |
if not self._AllCpusAreOnline(): |
@@ -46,6 +54,8 @@ class PerfControl(object): |
def SetDefaultPerfMode(self): |
"""Sets the performance mode for the device to its default mode.""" |
+ if not self._device.old_interface.IsRootEnabled(): |
+ return |
product_model = self._device.GetProp('ro.product.model') |
governor_mode = { |
'GT-I9300': 'pegasusq', |