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 b6a0989eb9f052c7e54459f7b0e1e725d54b90a3..f89f397d24e2930f54a8d737aeb54166912555e4 100644 |
--- a/build/android/pylib/perf/perf_control.py |
+++ b/build/android/pylib/perf/perf_control.py |
@@ -6,8 +6,10 @@ import atexit |
import logging |
from pylib import android_commands |
+from pylib.device import device_errors |
from pylib.device import device_utils |
+ |
class PerfControl(object): |
"""Provides methods for setting the performance mode of a device.""" |
_CPU_PATH = '/sys/devices/system/cpu' |
@@ -28,7 +30,9 @@ class PerfControl(object): |
def SetHighPerfMode(self): |
"""Sets the highest stable performance mode for the device.""" |
- if not self._device.HasRoot(): |
+ try: |
+ self._device.EnableRoot() |
+ except device_errors.CommandFailedError: |
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 |