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

Side by Side Diff: tools/android/memdump/memreport.py

Issue 243403003: [Android] Change object types from AndroidCommands to DeviceUtils everywhere else. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « chrome/test/chromedriver/test/test_environment.py ('k') | tools/android/mempressure.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
22 from pylib import constants 21 from pylib import constants
22 from pylib.device import device_utils
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', '.* ""'), 30 ('Anonymous total', '.* ""'),
31 ('Anonymous read-write', '.* rw.. .* ""'), 31 ('Anonymous read-write', '.* rw.. .* ""'),
32 ('Anonymous executable (JIT\'ed code)', '.* ..x. .* ""'), 32 ('Anonymous executable (JIT\'ed code)', '.* ..x. .* ""'),
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 all_pids[p] for p in pids 198 all_pids[p] for p in pids
199 ])) 199 ]))
200 print Template(_HTML_TEMPLATE).safe_substitute({ 200 print Template(_HTML_TEMPLATE).safe_substitute({
201 'JSON_PIDS': json.dumps(pids), 201 'JSON_PIDS': json.dumps(pids),
202 'JSON_PIDS_INFO': json.dumps(pids_info) 202 'JSON_PIDS_INFO': json.dumps(pids_info)
203 }) 203 })
204 204
205 205
206 206
207 def _CollectStats(count): 207 def _CollectStats(count):
208 adb = android_commands.AndroidCommands() 208 device = device_utils.DeviceUtils()
209 pid_list = adb.ExtractPid(package_name) 209 pid_list = device.old_interface.ExtractPid(package_name)
210 memdump = adb.RunShellCommand('/data/local/tmp/memdump ' + 210 memdump = device.old_interface.RunShellCommand(
211 ' '.join(pid_list)) 211 '/data/local/tmp/memdump ' + ' '.join(pid_list))
212 process_stats = _CollectMemoryStats(memdump, 212 process_stats = _CollectMemoryStats(memdump,
213 [value for (key, value) in _ENTRIES]) 213 [value for (key, value) in _ENTRIES])
214 for (pid, process) in zip(pid_list, process_stats): 214 for (pid, process) in zip(pid_list, process_stats):
215 first_pid_entry = True 215 first_pid_entry = True
216 for (k, v) in _ENTRIES: 216 for (k, v) in _ENTRIES:
217 if v not in process: 217 if v not in process:
218 continue 218 continue
219 for area_type in _AREA_TYPES: 219 for area_type in _AREA_TYPES:
220 legend = k + '_' + area_type 220 legend = k + '_' + area_type
221 if pid not in all_pids: 221 if pid not in all_pids:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 type='int', 269 type='int',
270 help='Interval in seconds for manual collections.') 270 help='Interval in seconds for manual collections.')
271 options, args = parser.parse_args(argv) 271 options, args = parser.parse_args(argv)
272 if options.manual_graph: 272 if options.manual_graph:
273 return _RunManualGraph(options.package, options.interval) 273 return _RunManualGraph(options.package, options.interval)
274 _DumpCSV(_CollectMemoryStats(sys.stdin, [value for (key, value) in _ENTRIES])) 274 _DumpCSV(_CollectMemoryStats(sys.stdin, [value for (key, value) in _ENTRIES]))
275 275
276 276
277 if __name__ == '__main__': 277 if __name__ == '__main__':
278 main(sys.argv) 278 main(sys.argv)
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/test/test_environment.py ('k') | tools/android/mempressure.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698