| 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 """ |
| 11 | 11 |
| 12 import collections | 12 import collections |
| 13 import json | 13 import json |
| 14 import logging |
| 14 import operator | 15 import operator |
| 15 import optparse | 16 import optparse |
| 16 import os | 17 import os |
| 17 import re | 18 import re |
| 18 import sys | 19 import sys |
| 19 import tempfile | 20 import tempfile |
| 20 import zipfile | 21 import zipfile |
| 21 import zlib | 22 import zlib |
| 22 | 23 |
| 23 import devil_chromium | 24 import devil_chromium |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 402 |
| 402 PrintResourceSizes(files, chartjson=chartjson) | 403 PrintResourceSizes(files, chartjson=chartjson) |
| 403 | 404 |
| 404 for f in files: | 405 for f in files: |
| 405 if f.endswith('.apk'): | 406 if f.endswith('.apk'): |
| 406 PrintApkAnalysis(f, chartjson=chartjson) | 407 PrintApkAnalysis(f, chartjson=chartjson) |
| 407 PrintPakAnalysis(f, options.min_pak_resource_size) | 408 PrintPakAnalysis(f, options.min_pak_resource_size) |
| 408 | 409 |
| 409 if chartjson: | 410 if chartjson: |
| 410 results_path = os.path.join(options.output_dir, 'results-chart.json') | 411 results_path = os.path.join(options.output_dir, 'results-chart.json') |
| 412 logging.critical('Dumping json to %s', results_path) |
| 411 with open(results_path, 'w') as json_file: | 413 with open(results_path, 'w') as json_file: |
| 412 json.dump(chartjson, json_file) | 414 json.dump(chartjson, json_file) |
| 413 | 415 |
| 414 | 416 |
| 415 if __name__ == '__main__': | 417 if __name__ == '__main__': |
| 416 sys.exit(main(sys.argv)) | 418 sys.exit(main(sys.argv)) |
| OLD | NEW |