| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 # Output the overall pak file summary. | 360 # Output the overall pak file summary. |
| 361 total_files = len(paks) | 361 total_files = len(paks) |
| 362 total_compress_size = sum(pak.compress_size for pak in paks) | 362 total_compress_size = sum(pak.compress_size for pak in paks) |
| 363 total_file_size = sum(pak.file_size for pak in paks) | 363 total_file_size = sum(pak.file_size for pak in paks) |
| 364 print 'Total pak files: %d' % total_files | 364 print 'Total pak files: %d' % total_files |
| 365 print 'Total compressed size: %s' % _FormatBytes(total_compress_size) | 365 print 'Total compressed size: %s' % _FormatBytes(total_compress_size) |
| 366 print 'Total uncompressed size: %s' % _FormatBytes(total_file_size) | 366 print 'Total uncompressed size: %s' % _FormatBytes(total_file_size) |
| 367 print | 367 print |
| 368 | 368 |
| 369 if not paks: |
| 370 return |
| 371 |
| 369 # Output the table of details about all pak files. | 372 # Output the table of details about all pak files. |
| 370 print '%25s%11s%21s%21s' % ( | 373 print '%25s%11s%21s%21s' % ( |
| 371 'FILENAME', 'RESOURCES', 'COMPRESSED SIZE', 'UNCOMPRESSED SIZE') | 374 'FILENAME', 'RESOURCES', 'COMPRESSED SIZE', 'UNCOMPRESSED SIZE') |
| 372 for pak in sorted(paks, key=operator.attrgetter('file_size'), reverse=True): | 375 for pak in sorted(paks, key=operator.attrgetter('file_size'), reverse=True): |
| 373 print '%25s %10s %12s %6.2f%% %12s %6.2f%%' % ( | 376 print '%25s %10s %12s %6.2f%% %12s %6.2f%%' % ( |
| 374 pak.filename, | 377 pak.filename, |
| 375 len(pak.resources), | 378 len(pak.resources), |
| 376 _FormatBytes(pak.compress_size), | 379 _FormatBytes(pak.compress_size), |
| 377 100.0 * pak.compress_size / total_compress_size, | 380 100.0 * pak.compress_size / total_compress_size, |
| 378 _FormatBytes(pak.file_size), | 381 _FormatBytes(pak.file_size), |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 592 |
| 590 if chartjson: | 593 if chartjson: |
| 591 results_path = os.path.join(options.output_dir, 'results-chart.json') | 594 results_path = os.path.join(options.output_dir, 'results-chart.json') |
| 592 logging.critical('Dumping json to %s', results_path) | 595 logging.critical('Dumping json to %s', results_path) |
| 593 with open(results_path, 'w') as json_file: | 596 with open(results_path, 'w') as json_file: |
| 594 json.dump(chartjson, json_file) | 597 json.dump(chartjson, json_file) |
| 595 | 598 |
| 596 | 599 |
| 597 if __name__ == '__main__': | 600 if __name__ == '__main__': |
| 598 sys.exit(main(sys.argv)) | 601 sys.exit(main(sys.argv)) |
| OLD | NEW |