| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Prints the size of each given file and optionally computes the size of | 6 """Prints the size of each given file and optionally computes the size of |
| 7 libchrome.so without the dependencies added for building with android NDK. | 7 libchrome.so without the dependencies added for building with android NDK. |
| 8 Also breaks down the contents of the APK to determine the installed size | 8 Also breaks down the contents of the APK to determine the installed size |
| 9 and assign size contributions to different classes of file. | 9 and assign size contributions to different classes of file. |
| 10 """ | 10 """ |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 help='Minimum byte size of displayed pak resources.') | 729 help='Minimum byte size of displayed pak resources.') |
| 730 argparser.add_argument('--chromium-output-directory', | 730 argparser.add_argument('--chromium-output-directory', |
| 731 help='Location of the build artifacts.') | 731 help='Location of the build artifacts.') |
| 732 argparser.add_argument('--chartjson', action='store_true', | 732 argparser.add_argument('--chartjson', action='store_true', |
| 733 help='Sets output mode to chartjson.') | 733 help='Sets output mode to chartjson.') |
| 734 argparser.add_argument('--output-dir', default='.', | 734 argparser.add_argument('--output-dir', default='.', |
| 735 help='Directory to save chartjson to.') | 735 help='Directory to save chartjson to.') |
| 736 argparser.add_argument('--no-output-dir', action='store_true', | 736 argparser.add_argument('--no-output-dir', action='store_true', |
| 737 help='Skip all measurements that rely on having ' | 737 help='Skip all measurements that rely on having ' |
| 738 'output-dir') | 738 'output-dir') |
| 739 argparser.add_argument('--no-static-initializer-check', action='store_false', |
| 740 dest='static_initializer_check', default=True, |
| 741 help='Skip checking for static initializers') |
| 739 argparser.add_argument('-d', '--device', | 742 argparser.add_argument('-d', '--device', |
| 740 help='Dummy option for perf runner.') | 743 help='Dummy option for perf runner.') |
| 741 argparser.add_argument('--estimate-patch-size', action='store_true', | 744 argparser.add_argument('--estimate-patch-size', action='store_true', |
| 742 help='Include patch size estimates. Useful for perf ' | 745 help='Include patch size estimates. Useful for perf ' |
| 743 'builders where a reference APK is available but adds ' | 746 'builders where a reference APK is available but adds ' |
| 744 '~3 mins to run time.') | 747 '~3 mins to run time.') |
| 745 argparser.add_argument('--reference-apk-builder', | 748 argparser.add_argument('--reference-apk-builder', |
| 746 default=apk_downloader.DEFAULT_BUILDER, | 749 default=apk_downloader.DEFAULT_BUILDER, |
| 747 help='Builder name to use for reference APK for patch ' | 750 help='Builder name to use for reference APK for patch ' |
| 748 'size estimates.') | 751 'size estimates.') |
| (...skipping 16 matching lines...) Expand all Loading... |
| 765 else: | 768 else: |
| 766 tools_prefix = '' | 769 tools_prefix = '' |
| 767 | 770 |
| 768 PrintApkAnalysis(args.apk, tools_prefix, chartjson=chartjson) | 771 PrintApkAnalysis(args.apk, tools_prefix, chartjson=chartjson) |
| 769 _PrintDexAnalysis(args.apk, chartjson=chartjson) | 772 _PrintDexAnalysis(args.apk, chartjson=chartjson) |
| 770 if args.estimate_patch_size: | 773 if args.estimate_patch_size: |
| 771 _PrintPatchSizeEstimate(args.apk, args.reference_apk_builder, | 774 _PrintPatchSizeEstimate(args.apk, args.reference_apk_builder, |
| 772 args.reference_apk_bucket, chartjson=chartjson) | 775 args.reference_apk_bucket, chartjson=chartjson) |
| 773 if not args.no_output_dir: | 776 if not args.no_output_dir: |
| 774 PrintPakAnalysis(args.apk, args.min_pak_resource_size) | 777 PrintPakAnalysis(args.apk, args.min_pak_resource_size) |
| 775 _PrintStaticInitializersCountFromApk( | 778 if args.static_initializer_check: |
| 776 args.apk, tools_prefix, chartjson=chartjson) | 779 _PrintStaticInitializersCountFromApk( |
| 780 args.apk, tools_prefix, chartjson=chartjson) |
| 777 if chartjson: | 781 if chartjson: |
| 778 results_path = os.path.join(args.output_dir, 'results-chart.json') | 782 results_path = os.path.join(args.output_dir, 'results-chart.json') |
| 779 logging.critical('Dumping json to %s', results_path) | 783 logging.critical('Dumping json to %s', results_path) |
| 780 with open(results_path, 'w') as json_file: | 784 with open(results_path, 'w') as json_file: |
| 781 json.dump(chartjson, json_file) | 785 json.dump(chartjson, json_file) |
| 782 | 786 |
| 783 | 787 |
| 784 if __name__ == '__main__': | 788 if __name__ == '__main__': |
| 785 sys.exit(main()) | 789 sys.exit(main()) |
| OLD | NEW |