| 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 logging | 5 import logging | 
| 6 | 6 | 
| 7 from pylib import android_commands | 7 from pylib import android_commands | 
| 8 from pylib.device import device_utils | 8 from pylib.device import device_utils | 
| 9 | 9 | 
| 10 | 10 | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 39     """Sets the highest possible performance mode for the device.""" | 39     """Sets the highest possible performance mode for the device.""" | 
| 40     self._ForceAllCpusOnline(True) | 40     self._ForceAllCpusOnline(True) | 
| 41     self._SetScalingGovernorInternal('performance') | 41     self._SetScalingGovernorInternal('performance') | 
| 42     if not self._AllCpusAreOnline(): | 42     if not self._AllCpusAreOnline(): | 
| 43       if not self._device.old_interface.IsRootEnabled(): | 43       if not self._device.old_interface.IsRootEnabled(): | 
| 44         raise RuntimeError('Need root to force CPUs online.') | 44         raise RuntimeError('Need root to force CPUs online.') | 
| 45       raise RuntimeError('Failed to force CPUs online.') | 45       raise RuntimeError('Failed to force CPUs online.') | 
| 46 | 46 | 
| 47   def SetDefaultPerfMode(self): | 47   def SetDefaultPerfMode(self): | 
| 48     """Sets the performance mode for the device to its default mode.""" | 48     """Sets the performance mode for the device to its default mode.""" | 
| 49     product_model = self._device.old_interface.GetProductModel() | 49     product_model = self._device.GetProp('ro.product.model') | 
| 50     governor_mode = { | 50     governor_mode = { | 
| 51         'GT-I9300': 'pegasusq', | 51         'GT-I9300': 'pegasusq', | 
| 52         'Galaxy Nexus': 'interactive', | 52         'Galaxy Nexus': 'interactive', | 
| 53         'Nexus 4': 'ondemand', | 53         'Nexus 4': 'ondemand', | 
| 54         'Nexus 7': 'interactive', | 54         'Nexus 7': 'interactive', | 
| 55         'Nexus 10': 'interactive' | 55         'Nexus 10': 'interactive' | 
| 56     }.get(product_model, 'ondemand') | 56     }.get(product_model, 'ondemand') | 
| 57     self._SetScalingGovernorInternal(governor_mode) | 57     self._SetScalingGovernorInternal(governor_mode) | 
| 58     self._ForceAllCpusOnline(False) | 58     self._ForceAllCpusOnline(False) | 
| 59 | 59 | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92 | 92 | 
| 93     if not self._have_mpdecision and not self._AllCpusAreOnline(): | 93     if not self._have_mpdecision and not self._AllCpusAreOnline(): | 
| 94       logging.warning('Unexpected cpu hot plugging detected.') | 94       logging.warning('Unexpected cpu hot plugging detected.') | 
| 95 | 95 | 
| 96     if not force_online: | 96     if not force_online: | 
| 97       return | 97       return | 
| 98 | 98 | 
| 99     for cpu in range(self._num_cpu_cores): | 99     for cpu in range(self._num_cpu_cores): | 
| 100       online_path = PerfControl._CPU_ONLINE_FMT % cpu | 100       online_path = PerfControl._CPU_ONLINE_FMT % cpu | 
| 101       self._device.WriteFile(online_path, '1', as_root=True) | 101       self._device.WriteFile(online_path, '1', as_root=True) | 
| OLD | NEW | 
|---|