OLD | NEW |
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 """Generate a spatial analysis against an arbitrary library. | 6 """Generate a spatial analysis against an arbitrary library. |
7 | 7 |
8 To use, build the 'binary_size_tool' target. Then run this tool, passing | 8 To use, build the 'binary_size_tool' target. Then run this tool, passing |
9 in the location of the library to be analyzed along with any other options | 9 in the location of the library to be analyzed along with any other options |
10 you desire. | 10 you desire. |
(...skipping 18 matching lines...) Expand all Loading... |
29 # the chromium project has figured out a proper way to organize the | 29 # the chromium project has figured out a proper way to organize the |
30 # library of python tools. http://crbug.com/375725 | 30 # library of python tools. http://crbug.com/375725 |
31 elf_symbolizer_path = os.path.abspath(os.path.join( | 31 elf_symbolizer_path = os.path.abspath(os.path.join( |
32 os.path.dirname(__file__), | 32 os.path.dirname(__file__), |
33 '..', | 33 '..', |
34 '..', | 34 '..', |
35 'build', | 35 'build', |
36 'android', | 36 'android', |
37 'pylib')) | 37 'pylib')) |
38 sys.path.append(elf_symbolizer_path) | 38 sys.path.append(elf_symbolizer_path) |
39 import symbols.elf_symbolizer as elf_symbolizer | 39 import symbols.elf_symbolizer as elf_symbolizer # pylint: disable=F0401 |
40 | 40 |
41 | 41 |
42 # TODO(andrewhayden): Only used for legacy reports. Delete. | 42 # TODO(andrewhayden): Only used for legacy reports. Delete. |
43 def FormatBytes(byte_count): | 43 def FormatBytes(byte_count): |
44 """Pretty-print a number of bytes.""" | 44 """Pretty-print a number of bytes.""" |
45 if byte_count > 1e6: | 45 if byte_count > 1e6: |
46 byte_count = byte_count / 1.0e6 | 46 byte_count = byte_count / 1.0e6 |
47 return '%.1fm' % byte_count | 47 return '%.1fm' % byte_count |
48 if byte_count > 1e3: | 48 if byte_count > 1e3: |
49 byte_count = byte_count / 1.0e3 | 49 byte_count = byte_count / 1.0e3 |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 print('Copying index.html') | 681 print('Copying index.html') |
682 shutil.copy(os.path.join(template_src, 'index.html'), opts.destdir) | 682 shutil.copy(os.path.join(template_src, 'index.html'), opts.destdir) |
683 shutil.copy(os.path.join(template_src, 'D3SymbolTreeMap.js'), opts.destdir) | 683 shutil.copy(os.path.join(template_src, 'D3SymbolTreeMap.js'), opts.destdir) |
684 | 684 |
685 if opts.verbose: | 685 if opts.verbose: |
686 print 'Report saved to ' + opts.destdir + '/index.html' | 686 print 'Report saved to ' + opts.destdir + '/index.html' |
687 | 687 |
688 | 688 |
689 if __name__ == '__main__': | 689 if __name__ == '__main__': |
690 sys.exit(main()) | 690 sys.exit(main()) |
OLD | NEW |