diff options
author | pliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 11:00:30 +0000 |
---|---|---|
committer | pliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-14 11:00:30 +0000 |
commit | 787b3c6b95890fe128c642bcdfcd8bb0060846d7 (patch) | |
tree | 54b194439340329aa808cc3579bbdb90fdc5130a /tools/android | |
parent | ff2bd1be8e8b7b6d10018cf654e676890a02898b (diff) | |
download | chromium_src-787b3c6b95890fe128c642bcdfcd8bb0060846d7.zip chromium_src-787b3c6b95890fe128c642bcdfcd8bb0060846d7.tar.gz chromium_src-787b3c6b95890fe128c642bcdfcd8bb0060846d7.tar.bz2 |
Purge unpinned ashmem before parsing /proc/$pid/smaps.
This will help stabilize memory measurements so that memory regressions can't
be hidden when unpinned ashmem gets purged by the kernel.
BUG=311633
Review URL: https://codereview.chromium.org/52833002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/android')
-rw-r--r-- | tools/android/android_tools.gyp | 3 | ||||
-rw-r--r-- | tools/android/purge_ashmem/purge_ashmem.c | 20 | ||||
-rw-r--r-- | tools/android/purge_ashmem/purge_ashmem.gyp | 34 |
3 files changed, 56 insertions, 1 deletions
diff --git a/tools/android/android_tools.gyp b/tools/android/android_tools.gyp index 6bad985..ed5e905 100644 --- a/tools/android/android_tools.gyp +++ b/tools/android/android_tools.gyp @@ -10,9 +10,10 @@ 'target_name': 'android_tools', 'type': 'none', 'dependencies': [ + 'adb_reboot/adb_reboot.gyp:adb_reboot', 'forwarder2/forwarder.gyp:forwarder2', 'md5sum/md5sum.gyp:md5sum', - 'adb_reboot/adb_reboot.gyp:adb_reboot', + 'purge_ashmem/purge_ashmem.gyp:purge_ashmem', ], }, { diff --git a/tools/android/purge_ashmem/purge_ashmem.c b/tools/android/purge_ashmem/purge_ashmem.c new file mode 100644 index 0000000..0de582d --- /dev/null +++ b/tools/android/purge_ashmem/purge_ashmem.c @@ -0,0 +1,20 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "third_party/ashmem/ashmem.h" + +int main(void) { + const int pages_purged = ashmem_purge_all(); + if (pages_purged < 0) { + perror("ashmem_purge_all"); + return EXIT_FAILURE; + } + printf("Purged %d pages (%d KBytes)\n", + pages_purged, pages_purged * getpagesize() / 1024); + return EXIT_SUCCESS; +} diff --git a/tools/android/purge_ashmem/purge_ashmem.gyp b/tools/android/purge_ashmem/purge_ashmem.gyp new file mode 100644 index 0000000..842d756 --- /dev/null +++ b/tools/android/purge_ashmem/purge_ashmem.gyp @@ -0,0 +1,34 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'purge_ashmem', + 'type': 'executable', + 'dependencies': [ + '../../../third_party/ashmem/ashmem.gyp:ashmem', + ], + 'include_dirs': [ + '../../../', + ], + 'conditions': [ + # Warning: A PIE tool cannot run on ICS 4.0.4, so only + # build it as position-independent when ASAN + # is activated. See b/6587214 for details. + [ 'asan==1', { + 'cflags': [ + '-fPIE', + ], + 'ldflags': [ + '-pie', + ], + }], + ], + 'sources': [ + 'purge_ashmem.c', + ], + }, + ], +} |