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

Unified Diff: build/android/pylib/android_commands.py

Issue 17463008: [Android] Log the size of data transerred to device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 6 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/base/base_test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 9146c020f00e6231c6d70ef3360b61bb98a62774..3df37b9b4143e53fc50665ab5251fdfc07d6f691 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -220,6 +220,8 @@ class AndroidCommands(object):
self._logcat_tmpoutfile = None
self._pushed_files = []
self._device_utc_offset = None
+ self._potential_push_size = 0
+ self._actual_push_size = 0
self._md5sum_build_dir = ''
self._external_storage = ''
self._util_wrapper = ''
@@ -708,8 +710,6 @@ class AndroidCommands(object):
Returns:
True if the md5sums match.
"""
- assert os.path.exists(local_path), 'Local path not found %s' % local_path
-
if not self._md5sum_build_dir:
default_build_type = os.environ.get('BUILD_TYPE', 'Debug')
build_dir = '%s/%s/' % (
@@ -723,7 +723,6 @@ class AndroidCommands(object):
assert _HasAdbPushSucceeded(self._adb.SendCommand(command))
self._md5sum_build_dir = build_dir
- self._pushed_files.append(device_path)
hashes_on_device = _ComputeFileListHash(
self.RunShellCommand(MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper +
' ' + MD5SUM_DEVICE_PATH + ' ' + device_path))
@@ -746,9 +745,15 @@ class AndroidCommands(object):
All pushed files can be removed by calling RemovePushedFiles().
"""
+ assert os.path.exists(local_path), 'Local path not found %s' % local_path
+ size = int(cmd_helper.GetCmdOutput(['du', '-sb', local_path]).split()[0])
+ self._pushed_files.append(device_path)
+ self._potential_push_size += size
+
if self.CheckMd5Sum(local_path, device_path):
return
+ self._actual_push_size += size
# They don't match, so remove everything first and then create it.
if os.path.isdir(local_path):
self.RunShellCommand('rm -r %s' % device_path, timeout_time=2 * 60)
@@ -761,6 +766,15 @@ class AndroidCommands(object):
output = self._adb.SendCommand(push_command, timeout_time=30 * 60)
assert _HasAdbPushSucceeded(output)
+ def GetPushSizeInfo(self):
+ """Get total size of pushes to the device done via PushIfNeeded()
+
+ Returns:
+ A tuple:
+ 1. Total size of push requests to PushIfNeeded (MB)
+ 2. Total size that was actually pushed (MB)
+ """
+ return (self._potential_push_size, self._actual_push_size)
def GetFileContents(self, filename, log_result=False):
"""Gets contents from the file specified by |filename|."""
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698