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

Side by Side Diff: tools/binary_size/explain_binary_size_delta.py

Issue 797363002: binary_size: Remove legacy path, keep / as / for unittests on windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/binary_size/legacy_template/.gitignore » ('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 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Describe the size difference of two binaries. 6 """Describe the size difference of two binaries.
7 7
8 Generates a description of the size difference of two binaries based 8 Generates a description of the size difference of two binaries based
9 on the difference of the size of various symbols. 9 on the difference of the size of various symbols.
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 cache1 = {} 60 cache1 = {}
61 cache2 = {} 61 cache2 = {}
62 # Make a map of (file, symbol_type) : (symbol_name, symbol_size) 62 # Make a map of (file, symbol_type) : (symbol_name, symbol_size)
63 for cache, symbols in ((cache1, symbols1), (cache2, symbols2)): 63 for cache, symbols in ((cache1, symbols1), (cache2, symbols2)):
64 for symbol_name, symbol_type, symbol_size, file_path in symbols: 64 for symbol_name, symbol_type, symbol_size, file_path in symbols:
65 if 'vtable for ' in symbol_name: 65 if 'vtable for ' in symbol_name:
66 symbol_type = '@' # hack to categorize these separately 66 symbol_type = '@' # hack to categorize these separately
67 if file_path: 67 if file_path:
68 file_path = os.path.normpath(file_path) 68 file_path = os.path.normpath(file_path)
69 if sys.platform.startswith('win'):
70 file_path = file_path.replace('\\', '/')
69 else: 71 else:
70 file_path = '(No Path)' 72 file_path = '(No Path)'
71 key = (file_path, symbol_type) 73 key = (file_path, symbol_type)
72 bucket = cache.setdefault(key, {}) 74 bucket = cache.setdefault(key, {})
73 size_list = bucket.setdefault(symbol_name, []) 75 size_list = bucket.setdefault(symbol_name, [])
74 size_list.append(symbol_size) 76 size_list.append(symbol_size)
75 77
76 # Now diff them. We iterate over the elements in cache1. For each symbol 78 # Now diff them. We iterate over the elements in cache1. For each symbol
77 # that we find in cache2, we record whether it was deleted, changed, or 79 # that we find in cache2, we record whether it was deleted, changed, or
78 # unchanged. We then remove it from cache2; all the symbols that remain 80 # unchanged. We then remove it from cache2; all the symbols that remain
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 with file(path, 'r') as nm_input: 353 with file(path, 'r') as nm_input:
352 if opts.verbose: 354 if opts.verbose:
353 print 'parsing ' + path + '...' 355 print 'parsing ' + path + '...'
354 symbols.append(list(binary_size_utils.ParseNm(nm_input))) 356 symbols.append(list(binary_size_utils.ParseNm(nm_input)))
355 (added, removed, changed, unchanged) = Compare(symbols[0], symbols[1]) 357 (added, removed, changed, unchanged) = Compare(symbols[0], symbols[1])
356 CrunchStats(added, removed, changed, unchanged, 358 CrunchStats(added, removed, changed, unchanged,
357 opts.showsources | opts.showsymbols, opts.showsymbols) 359 opts.showsources | opts.showsymbols, opts.showsymbols)
358 360
359 if __name__ == '__main__': 361 if __name__ == '__main__':
360 sys.exit(main()) 362 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/binary_size/legacy_template/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698