summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrnephew <rnephew@chromium.org>2015-04-01 15:34:15 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-01 22:35:59 +0000
commitb380a28893cb6b26613aa79ecfb2e59c652035cf (patch)
tree381fe341a3936125db82fa53c2d017b7c6135578
parent1f5f150ebbf0651a579ca939029dab3292188066 (diff)
downloadchromium_src-b380a28893cb6b26613aa79ecfb2e59c652035cf.zip
chromium_src-b380a28893cb6b26613aa79ecfb2e59c652035cf.tar.gz
chromium_src-b380a28893cb6b26613aa79ecfb2e59c652035cf.tar.bz2
[Telemetry][Android] Change how ps is handled.
Currently there is an issue with ps output being cut short. One possible cause for this is too large of output. This will fix the problem if that is the issue. BUG=471122 Review URL: https://codereview.chromium.org/1048203002 Cr-Commit-Position: refs/heads/master@{#323348}
-rw-r--r--tools/telemetry/telemetry/core/platform/android_platform_backend.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend.py b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
index acdd8b6..e032460 100644
--- a/tools/telemetry/telemetry/core/platform/android_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
@@ -41,6 +41,7 @@ from pylib.device import device_errors # pylint: disable=F0401
from pylib.perf import cache_control # pylint: disable=F0401
from pylib.perf import perf_control # pylint: disable=F0401
from pylib.perf import thermal_throttle # pylint: disable=F0401
+from pylib.utils import device_temp_file # pylint: disable=F0401
from pylib import screenshot # pylint: disable=F0401
try:
@@ -357,23 +358,20 @@ class AndroidPlatformBackend(
command = 'ps'
if pid:
command += ' -p %d' % pid
- ps = self._device.RunShellCommand(command)[1:]
+ with device_temp_file.DeviceTempFile(self._device.adb) as ps_out:
+ command += ' > %s' % ps_out.name
+ self._device.RunShellCommand(command)
+ # Get rid of trailing new line and header.
+ ps = self._device.ReadFile(ps_out.name).split('\n')[1:-1]
output = []
for line in ps:
- # TODO(rnephew): Remove when crbug.com/471122 is solved.
- try:
- data = line.split()
- curr_pid = data[1]
- curr_name = data[-1]
- if columns == ['pid', 'name']:
- output.append([curr_pid, curr_name])
- else:
- output.append([curr_pid])
- except IndexError:
- logging.warning(
- 'Error in processing ps line:\n%s\nFull ps contents:\n%s\n'
- % (line, ps))
- raise
+ data = line.split()
+ curr_pid = data[1]
+ curr_name = data[-1]
+ if columns == ['pid', 'name']:
+ output.append([curr_pid, curr_name])
+ else:
+ output.append([curr_pid])
return output
def RunCommand(self, command):