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

Unified Diff: tools/telemetry/telemetry/core/platform/android_platform_backend.py

Issue 91573003: Make page_cycler.py fully measure memory for each page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Shadi's comment Created 7 years 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
Index: tools/telemetry/telemetry/core/platform/android_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend.py b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
index 2332d015f3b8701913749358eb797da9824c3df3..112115c8774ebf201d088c9ba9b38ebf555eabad 100644
--- a/tools/telemetry/telemetry/core/platform/android_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
@@ -8,6 +8,7 @@ from telemetry.core import exceptions
from telemetry.core import platform
from telemetry.core import util
from telemetry.core.platform import proc_supporting_platform_backend
+from telemetry.core.platform.profiler import android_prebuilt_profiler_helper
# Get build/android scripts into our path.
util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
@@ -102,8 +103,19 @@ class AndroidPlatformBackend(
return {}
return super(AndroidPlatformBackend, self).GetCpuTimestamp()
+ def PurgeUnpinnedMemory(self):
+ """Purges the unpinned ashmem memory for the whole system.
+
+ This can be used to make memory measurements more stable in particular.
+ """
+ android_prebuilt_profiler_helper.InstallOnDevice(self._adb, 'purge_ashmem')
+ if self._adb.RunShellCommand(
+ android_prebuilt_profiler_helper.GetDevicePath('purge_ashmem'),
+ log_result=True):
+ return
+ raise Exception('Error while purging ashmem.')
+
def GetMemoryStats(self, pid):
- self._adb.PurgeUnpinnedAshmem()
memory_usage = self._adb.GetMemoryUsageForPid(pid)[0]
return {'ProportionalSetSize': memory_usage['Pss'] * 1024,
'SharedDirty': memory_usage['Shared_Dirty'] * 1024,
« no previous file with comments | « tools/telemetry/telemetry/core/browser.py ('k') | tools/telemetry/telemetry/core/platform/mac_platform_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698