OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 import json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
11 import re | 11 import re |
12 import threading | 12 import threading |
13 import time | 13 import time |
14 import sys | 14 import sys |
15 | 15 |
16 from sets import Set | 16 from sets import Set |
17 from string import Template | 17 from string import Template |
18 | 18 |
19 sys.path.append(os.path.join(sys.path[0], os.pardir, os.pardir, os.pardir, | 19 sys.path.append(os.path.join(sys.path[0], os.pardir, os.pardir, os.pardir, |
20 'build','android')) | 20 'build','android')) |
21 from pylib import android_commands | 21 from pylib import android_commands |
22 from pylib import constants | 22 from pylib import constants |
23 | 23 |
24 | 24 |
25 _ENTRIES = [ | 25 _ENTRIES = [ |
26 ('Total', '.* r... .*'), | 26 ('Total', '.* r... .*'), |
27 ('Read-only', '.* r--. .*'), | 27 ('Read-only', '.* r--. .*'), |
28 ('Read-write', '.* rw.. .*'), | 28 ('Read-write', '.* rw.. .*'), |
29 ('Executable', '.* ..x. .*'), | 29 ('Executable', '.* ..x. .*'), |
30 ('Anonymous total', '.* .... .* .*other=[0-9]+ ($|.*chromium:.*)'), | 30 ('Anonymous total', '.* .... .* .*other=[0-9]+ $'), |
31 ('Anonymous read-write', '.* rw.. .* .*other=[0-9]+ ($|.*chromium:.*)'), | 31 ('Anonymous read-write', '.* rw.. .* .*other=[0-9]+ $'), |
32 ('Anonymous executable (JIT\'ed code)', '.* ..x. .* shared_other=[0-9]+ $'), | 32 ('Anonymous executable (JIT\'ed code)', '.* ..x. .* shared_other=[0-9]+ $'), |
33 ('File total', '.* .... .* /.*'), | 33 ('File total', '.* .... .* /.*'), |
34 ('File read-write', '.* rw.. .* /.*'), | 34 ('File read-write', '.* rw.. .* /.*'), |
35 ('File executable', '.* ..x. .* /.*'), | 35 ('File executable', '.* ..x. .* /.*'), |
36 ('chromium mmap', '.* r... .*chromium:.*'), | 36 ('/dev files', '.* r... .* /dev/.*'), |
37 ('chromium TransferBuffer', '.* r... .*chromium:.*CreateTransferBuffer.*'), | |
38 ('Galaxy Nexus GL driver', '.* r... .*pvrsrvkm.*'), | |
39 ('Dalvik', '.* rw.. .* /.*dalvik.*'), | 37 ('Dalvik', '.* rw.. .* /.*dalvik.*'), |
40 ('Dalvik heap', '.* rw.. .* /.*dalvik-heap.*'), | 38 ('Dalvik heap', '.* rw.. .* /.*dalvik-heap.*'), |
41 ('Native heap (jemalloc)', '.* r... .* /.*jemalloc.*'), | 39 ('Native heap (malloc)', '.* r... .* .*malloc.*'), |
42 ('System heap', '.* r... .* \\[heap\\]'), | |
43 ('Ashmem', '.* rw.. .* /dev/ashmem .*'), | 40 ('Ashmem', '.* rw.. .* /dev/ashmem .*'), |
44 ('libchromeview.so total', '.* r... .* /.*libchromeview.so'), | 41 ('libchromeview.so total', '.* r... .* /.*libchromeview.so'), |
45 ('libchromeview.so read-only', '.* r--. .* /.*libchromeview.so'), | 42 ('libchromeview.so read-only', '.* r--. .* /.*libchromeview.so'), |
46 ('libchromeview.so read-write', '.* rw-. .* /.*libchromeview.so'), | 43 ('libchromeview.so read-write', '.* rw-. .* /.*libchromeview.so'), |
47 ('libchromeview.so executable', '.* r.x. .* /.*libchromeview.so'), | 44 ('libchromeview.so executable', '.* r.x. .* /.*libchromeview.so'), |
48 ] | 45 ] |
49 | 46 |
50 | 47 |
51 def _CollectMemoryStats(memdump, region_filters): | 48 def _CollectMemoryStats(memdump, region_filters): |
52 processes = [] | 49 processes = [] |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 type='int', | 262 type='int', |
266 help='Interval in seconds for manual collections.') | 263 help='Interval in seconds for manual collections.') |
267 options, args = parser.parse_args(argv) | 264 options, args = parser.parse_args(argv) |
268 if options.manual_graph: | 265 if options.manual_graph: |
269 return _RunManualGraph(options.package, options.interval) | 266 return _RunManualGraph(options.package, options.interval) |
270 _DumpCSV(_CollectMemoryStats(sys.stdin, [value for (key, value) in _ENTRIES])) | 267 _DumpCSV(_CollectMemoryStats(sys.stdin, [value for (key, value) in _ENTRIES])) |
271 | 268 |
272 | 269 |
273 if __name__ == '__main__': | 270 if __name__ == '__main__': |
274 main(sys.argv) | 271 main(sys.argv) |
OLD | NEW |