From 6419e5402e8d17795ead100074ce18f7ed09f4d2 Mon Sep 17 00:00:00 2001 From: jbudorick Date: Tue, 9 Jun 2015 15:00:53 -0700 Subject: [PATCH] [Android] Use large_output for calls to "ps" and "dumpsys batterystats". BUG= Review URL: https://codereview.chromium.org/1174633002 Cr-Commit-Position: refs/heads/master@{#333584} --- build/android/pylib/device/battery_utils.py | 2 +- build/android/pylib/device/battery_utils_test.py | 2 +- .../telemetry/telemetry/core/platform/android_platform_backend.py | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/build/android/pylib/device/battery_utils.py b/build/android/pylib/device/battery_utils.py index ed66591daa5c..7701c9ae25c0 100644 --- a/build/android/pylib/device/battery_utils.py +++ b/build/android/pylib/device/battery_utils.py @@ -294,7 +294,7 @@ class BatteryUtils(object): ['dumpsys', 'batterystats', '--reset'], check_return=True) battery_data = self._device.RunShellCommand( ['dumpsys', 'batterystats', '--charged', '--checkin'], - check_return=True) + check_return=True, large_output=True) ROW_TYPE_INDEX = 3 PWI_POWER_INDEX = 5 for line in battery_data: diff --git a/build/android/pylib/device/battery_utils_test.py b/build/android/pylib/device/battery_utils_test.py index 72799b8b5d10..bdfc48277956 100755 --- a/build/android/pylib/device/battery_utils_test.py +++ b/build/android/pylib/device/battery_utils_test.py @@ -115,7 +115,7 @@ class BatteryUtilsSetBatteryMeasurementTest(BatteryUtilsTest): ['dumpsys', 'batterystats', '--reset'], check_return=True), []), (self.call.device.RunShellCommand( ['dumpsys', 'batterystats', '--charged', '--checkin'], - check_return=True), []), + check_return=True, large_output=True), []), (self.call.device.RunShellCommand( ['dumpsys', 'battery', 'set', 'ac', '0'], check_return=True), []), (self.call.device.RunShellCommand( diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend.py b/tools/telemetry/telemetry/core/platform/android_platform_backend.py index 7f16e834033c..0464164ff26e 100644 --- a/tools/telemetry/telemetry/core/platform/android_platform_backend.py +++ b/tools/telemetry/telemetry/core/platform/android_platform_backend.py @@ -44,7 +44,6 @@ from pylib.device import device_errors # pylint: disable=import-error from pylib.perf import cache_control # pylint: disable=import-error from pylib.perf import perf_control # pylint: disable=import-error from pylib.perf import thermal_throttle # pylint: disable=import-error -from pylib.utils import device_temp_file # pylint: disable=import-error try: from pylib.perf import surface_stats_collector # pylint: disable=import-error @@ -386,11 +385,7 @@ class AndroidPlatformBackend( command = 'ps' if pid: command += ' -p %d' % pid - 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] + ps = self._device.RunShellCommand(command, large_output=True)[1:] output = [] for line in ps: data = line.split() -- 2.11.4.GIT