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 import time | 6 import time |
7 | 7 |
8 from pylib import android_commands | 8 from pylib import android_commands |
9 from pylib.device import device_utils | 9 from pylib.device import device_utils |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 measurement is started. | 82 measurement is started. |
83 - The scaling governor can't be set for an offline CPU and frequency scaling | 83 - The scaling governor can't be set for an offline CPU and frequency scaling |
84 on newly enabled CPUs adds noise to both perf and tracing measurements. | 84 on newly enabled CPUs adds noise to both perf and tracing measurements. |
85 | 85 |
86 It appears Qualcomm is the only vendor that hot-plugs CPUs, and on Qualcomm | 86 It appears Qualcomm is the only vendor that hot-plugs CPUs, and on Qualcomm |
87 this is done by "mpdecision". | 87 this is done by "mpdecision". |
88 | 88 |
89 """ | 89 """ |
90 if self._have_mpdecision: | 90 if self._have_mpdecision: |
91 script = 'stop mpdecision' if force_online else 'start mpdecision' | 91 script = 'stop mpdecision' if force_online else 'start mpdecision' |
92 self._device.RunShellCommand(script, root=True) | 92 self._device.RunShellCommand(script, as_root=True) |
93 | 93 |
94 if not self._have_mpdecision and not self._AllCpusAreOnline(): | 94 if not self._have_mpdecision and not self._AllCpusAreOnline(): |
95 logging.warning('Unexpected cpu hot plugging detected.') | 95 logging.warning('Unexpected cpu hot plugging detected.') |
96 | 96 |
97 if not force_online: | 97 if not force_online: |
98 return | 98 return |
99 | 99 |
100 for cpu in range(self._NumCpuCores): | 100 for cpu in range(self._NumCpuCores): |
101 online_path = PerfControl._CPU_ONLINE_FMT % cpu | 101 online_path = PerfControl._CPU_ONLINE_FMT % cpu |
102 self._device.old_interface.SetProtectedFileContents( | 102 self._device.old_interface.SetProtectedFileContents( |
103 online_path, '1') | 103 online_path, '1') |
104 | 104 |
105 # Double check all cores stayed online. | 105 # Double check all cores stayed online. |
106 time.sleep(0.25) | 106 time.sleep(0.25) |
107 if not self._AllCpusAreOnline(): | 107 if not self._AllCpusAreOnline(): |
108 raise RuntimeError('Failed to force CPUs online') | 108 raise RuntimeError('Failed to force CPUs online') |
OLD | NEW |