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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 args = argparser.parse_args() | 716 args = argparser.parse_args() |
717 | 717 |
718 chartjson = _BASE_CHART.copy() if args.chartjson else None | 718 chartjson = _BASE_CHART.copy() if args.chartjson else None |
719 | 719 |
720 if args.chromium_output_directory: | 720 if args.chromium_output_directory: |
721 constants.SetOutputDirectory(args.chromium_output_directory) | 721 constants.SetOutputDirectory(args.chromium_output_directory) |
722 if not args.no_output_dir: | 722 if not args.no_output_dir: |
723 constants.CheckOutputDirectory() | 723 constants.CheckOutputDirectory() |
724 devil_chromium.Initialize() | 724 devil_chromium.Initialize() |
725 build_vars = _ReadBuildVars(constants.GetOutDirectory()) | 725 build_vars = _ReadBuildVars(constants.GetOutDirectory()) |
726 tools_prefix = build_vars['android_tool_prefix'] | 726 tools_prefix = os.path.join(constants.GetOutDirectory(), |
| 727 build_vars['android_tool_prefix']) |
727 else: | 728 else: |
728 tools_prefix = '' | 729 tools_prefix = '' |
729 | 730 |
730 PrintApkAnalysis(args.apk, tools_prefix, chartjson=chartjson) | 731 PrintApkAnalysis(args.apk, tools_prefix, chartjson=chartjson) |
731 _PrintDexAnalysis(args.apk, chartjson=chartjson) | 732 _PrintDexAnalysis(args.apk, chartjson=chartjson) |
732 if not args.no_output_dir: | 733 if not args.no_output_dir: |
733 PrintPakAnalysis(args.apk, args.min_pak_resource_size) | 734 PrintPakAnalysis(args.apk, args.min_pak_resource_size) |
734 _PrintStaticInitializersCountFromApk( | 735 _PrintStaticInitializersCountFromApk( |
735 args.apk, tools_prefix, chartjson=chartjson) | 736 args.apk, tools_prefix, chartjson=chartjson) |
736 if chartjson: | 737 if chartjson: |
737 results_path = os.path.join(args.output_dir, 'results-chart.json') | 738 results_path = os.path.join(args.output_dir, 'results-chart.json') |
738 logging.critical('Dumping json to %s', results_path) | 739 logging.critical('Dumping json to %s', results_path) |
739 with open(results_path, 'w') as json_file: | 740 with open(results_path, 'w') as json_file: |
740 json.dump(chartjson, json_file) | 741 json.dump(chartjson, json_file) |
741 | 742 |
742 | 743 |
743 if __name__ == '__main__': | 744 if __name__ == '__main__': |
744 sys.exit(main()) | 745 sys.exit(main()) |
OLD | NEW |