Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index a09461d29e89cf8510efbba5b2e2fc4380fc9de3..4c2790759bfde5afa355ecd989b3c0d329ac60df 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -22,6 +22,9 @@ import time |
import cmd_helper |
import constants |
import screenshot |
+ |
+from utils import host_path_finder |
+ |
try: |
from pylib import pexpect |
except: |
@@ -1418,6 +1421,20 @@ class AndroidCommands(object): |
logging.warning('Could not find disk IO stats.') |
return None |
+ def PurgeUnpinnedAshmem(self): |
+ """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.') |
+ 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.') |
+ |
def GetMemoryUsageForPid(self, pid): |
"""Returns the memory usage for given pid. |