Merge pull request #112 from bjackman/speed-up-perturb
shutils: Speed up cpuidle_wake_all_cpus
diff --git a/devlib/instrument/energy_probe.py b/devlib/instrument/energy_probe.py
index 2e1f625..b7ad832 100644
--- a/devlib/instrument/energy_probe.py
+++ b/devlib/instrument/energy_probe.py
@@ -20,11 +20,6 @@
import struct
import subprocess
-try:
- import pandas
-except ImportError:
- pandas = None
-
from devlib.instrument import Instrument, CONTINUOUS, MeasurementsCsv
from devlib.exception import HostError
from devlib.utils.misc import which
@@ -50,9 +45,6 @@
if self.caiman is None:
raise HostError('caiman must be installed on the host '
'(see https://github.com/ARM-software/caiman)')
- if pandas is None:
- self.logger.info("pandas package will significantly speed up this instrument")
- self.logger.info("to install it try: pip install pandas")
self.attributes_per_sample = 3
self.bytes_per_sample = self.attributes_per_sample * 4
self.attributes = ['power', 'voltage', 'current']
diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py
index 25920f7..d72b8fd 100644
--- a/devlib/module/cpufreq.py
+++ b/devlib/module/cpufreq.py
@@ -152,10 +152,14 @@
valid_tunables = self.list_governor_tunables(cpu)
for tunable, value in kwargs.iteritems():
if tunable in valid_tunables:
+ path = '/sys/devices/system/cpu/{}/cpufreq/{}/{}'.format(cpu, governor, tunable)
try:
- path = '/sys/devices/system/cpu/{}/cpufreq/{}/{}'.format(cpu, governor, tunable)
self.target.write_value(path, value)
- except TargetError: # May be an older kernel
+ except TargetError:
+ if self.target.file_exists(path):
+ # File exists but we did something wrong
+ raise
+ # Expected file doesn't exist, try older sysfs layout.
path = '/sys/devices/system/cpu/cpufreq/{}/{}'.format(governor, tunable)
self.target.write_value(path, value)
else:
diff --git a/devlib/target.py b/devlib/target.py
index b6b9d5e..be2d021 100644
--- a/devlib/target.py
+++ b/devlib/target.py
@@ -882,8 +882,6 @@
output = self.execute(command, timeout=1, as_root=as_root)
except TimeoutError:
pass
- else:
- raise ValueError('Background command exited before timeout; got "{}"'.format(output))
def __setup_list_directory(self):
# In at least Linaro Android 16.09 (which was their first Android 7 release) and maybe
@@ -929,7 +927,7 @@
lines.next() # header
result = []
for line in lines:
- parts = line.split()
+ parts = line.split(None, 8)
if parts:
result.append(PsEntry(*(parts[0:1] + map(int, parts[1:5]) + parts[5:])))
if not kwargs:
diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py
index ff30346..af644bf 100644
--- a/devlib/utils/ssh.py
+++ b/devlib/utils/ssh.py
@@ -228,6 +228,9 @@
def _execute_and_wait_for_prompt(self, command, timeout=None, as_root=False, strip_colors=True, log=True):
self.conn.prompt(0.1) # clear an existing prompt if there is one.
+ if self.username == 'root':
+ # As we're already root, there is no need to use sudo.
+ as_root = False
if as_root:
command = "sudo -- sh -c '{}'".format(escape_single_quotes(command))
if log: