| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import atexit | 5 import atexit |
| 6 import logging | 6 import logging |
| 7 | 7 |
| 8 from pylib.device import device_errors | 8 from devil.android import device_errors |
| 9 from pylib.device import device_utils | 9 from devil.android import device_utils |
| 10 | 10 |
| 11 | 11 |
| 12 class PerfControl(object): | 12 class PerfControl(object): |
| 13 """Provides methods for setting the performance mode of a device.""" | 13 """Provides methods for setting the performance mode of a device.""" |
| 14 _CPU_PATH = '/sys/devices/system/cpu' | 14 _CPU_PATH = '/sys/devices/system/cpu' |
| 15 _KERNEL_MAX = '/sys/devices/system/cpu/kernel_max' | 15 _KERNEL_MAX = '/sys/devices/system/cpu/kernel_max' |
| 16 | 16 |
| 17 def __init__(self, device): | 17 def __init__(self, device): |
| 18 self._device = device | 18 self._device = device |
| 19 # this will raise an AdbCommandFailedError if no CPU files are found | 19 # this will raise an AdbCommandFailedError if no CPU files are found |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 """ | 148 """ |
| 149 if self._have_mpdecision: | 149 if self._have_mpdecision: |
| 150 script = 'stop mpdecision' if force_online else 'start mpdecision' | 150 script = 'stop mpdecision' if force_online else 'start mpdecision' |
| 151 self._device.RunShellCommand(script, check_return=True, as_root=True) | 151 self._device.RunShellCommand(script, check_return=True, as_root=True) |
| 152 | 152 |
| 153 if not self._have_mpdecision and not self._AllCpusAreOnline(): | 153 if not self._have_mpdecision and not self._AllCpusAreOnline(): |
| 154 logging.warning('Unexpected cpu hot plugging detected.') | 154 logging.warning('Unexpected cpu hot plugging detected.') |
| 155 | 155 |
| 156 if force_online: | 156 if force_online: |
| 157 self._ForEachCpu('echo 1 > "$CPU/online"') | 157 self._ForEachCpu('echo 1 > "$CPU/online"') |
| OLD | NEW |