Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index 6f9b99cc2405f9eab6760fe5d71d4fa5c5a9196c..355e4ffd26f193f7cfdcd22d885b405cce9b97cc 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -253,6 +253,7 @@ class AndroidCommands(object): |
self._actual_push_size = 0 |
self._external_storage = '' |
self._util_wrapper = '' |
+ self._purge_ashmem_binary_was_pushed = False |
def _LogShell(self, cmd): |
"""Logs the adb shell command.""" |
@@ -1435,16 +1436,23 @@ class AndroidCommands(object): |
logging.warning('Could not find disk IO stats.') |
return None |
+ def _PushPurgeAshmemBinaryIfNeeded(self): |
+ """Pushes the ashmem binary once at construction if needed.""" |
+ if not self._purge_ashmem_binary_was_pushed: |
+ host_path = host_path_finder.GetMostRecentHostPath('purge_ashmem') |
+ if not host_path: |
+ raise Exception('Could not find the purge_ashmem binary.') |
+ device_path = os.path.join(constants.TEST_EXECUTABLE_DIR, 'purge_ashmem') |
+ self.PushIfNeeded(host_path, device_path) |
+ self._purge_ashmem_binary_was_pushed = True |
+ |
def PurgeUnpinnedAshmem(self): |
bulach
2013/11/28 13:31:24
I think both _PushPurgeAshmemBinaryIfNeeded and Pu
Philippe
2013/11/28 17:03:04
Yeah, agreed :)
|
"""Purges the unpinned ashmem memory for the whole system. |
This can be used to make memory measurements more stable in particular. |
""" |
- host_path = host_path_finder.GetMostRecentHostPath('purge_ashmem') |
- if not host_path: |
- raise Exception('Could not find the purge_ashmem binary.') |
+ self._PushPurgeAshmemBinaryIfNeeded() |
device_path = os.path.join(constants.TEST_EXECUTABLE_DIR, 'purge_ashmem') |
- self.PushIfNeeded(host_path, device_path) |
if self.RunShellCommand(device_path, log_result=True): |
return |
raise Exception('Error while purging ashmem.') |