Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1409)

Unified Diff: build/android/pylib/device/device_utils.py

Issue 1077173002: [Android] Tune DeviceUtils commands that are prone to large outputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index f7167cea13a20e9401ff03556d1b4e49b8bddfb2..419740b7883955f578101f52ebc594dbcbb5cb86 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -593,7 +593,7 @@ class DeviceUtils(object):
CommandTimeoutError on timeout.
DeviceUnreachableError on missing device.
"""
- pids = self._GetPidsImpl(process_name)
+ pids = self.GetPids(process_name)
if not pids:
raise device_errors.CommandFailedError(
'No process "%s"' % process_name, str(self))
@@ -603,7 +603,7 @@ class DeviceUtils(object):
if blocking:
wait_period = 0.1
- while self._GetPidsImpl(process_name):
+ while self.GetPids(process_name):
time.sleep(wait_period)
return len(pids)
@@ -1020,7 +1020,8 @@ class DeviceUtils(object):
if size is None or size <= self._MAX_ADB_OUTPUT_LENGTH:
return _JoinLines(self.RunShellCommand(
- ['cat', device_path], as_root=as_root, check_return=True))
+ ['cat', device_path], as_root=as_root, check_return=True,
+ large_output=(not bool(size))))
perezju 2015/04/13 09:58:32 I don't think this makes much sense, and introduce
rnephew (Wrong account) 2015/04/13 17:21:04 In at least the /proc/ fs on the device, and proba
jbudorick 2015/04/13 17:44:29 This doesn't make much sense because what it's rea
elif as_root and self.NeedsSU():
with device_temp_file.DeviceTempFile(self.adb) as device_temp:
self.RunShellCommand(['cp', device_path, device_temp.name],
@@ -1353,11 +1354,9 @@ class DeviceUtils(object):
CommandTimeoutError on timeout.
DeviceUnreachableError on missing device.
"""
- return self._GetPidsImpl(process_name)
-
- def _GetPidsImpl(self, process_name):
procs_pids = {}
- for line in self.RunShellCommand('ps', check_return=True):
+ for line in self.RunShellCommand('ps', check_return=True,
+ large_output=True):
perezju 2015/04/13 09:58:32 This is precisely one of the things I really think
jbudorick 2015/04/13 17:44:29 Done.
try:
ps_data = line.split()
if process_name in ps_data[-1]:
@@ -1430,7 +1429,8 @@ class DeviceUtils(object):
'Private_Dirty')
showmap_out = self.RunShellCommand(
- ['showmap', str(pid)], as_root=True, check_return=True)
+ ['showmap', str(pid)], as_root=True, check_return=True,
+ large_output=True)
perezju 2015/04/13 09:58:32 How about: 'showmap {{pid}} | grep TOTAL'
jbudorick 2015/04/13 17:44:29 Done.
if not showmap_out:
raise device_errors.CommandFailedError('No output from showmap')
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698