OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2017 The Chromium Authors. All rights reserved. | 2 # Copyright 2017 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 """Tool for finding the cause of binary size bloat. | 6 """Tool for finding the cause of binary size bloat. |
7 | 7 |
8 See //tools/binary_size/README.md for example usage. | 8 See //tools/binary_size/README.md for example usage. |
9 | 9 |
10 Note: this tool will perform gclient sync/git checkout on your local repo if | 10 Note: this tool will perform gclient sync/git checkout on your local repo if |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 os.remove(diff_path) | 372 os.remove(diff_path) |
373 with open(diff_path, 'a') as diff_file: | 373 with open(diff_path, 'a') as diff_file: |
374 for d in self.diffs: | 374 for d in self.diffs: |
375 d.RunDiff(diff_file, before.dir, after.dir) | 375 d.RunDiff(diff_file, before.dir, after.dir) |
376 logging.info('See detailed diff results here: %s', | 376 logging.info('See detailed diff results here: %s', |
377 os.path.relpath(diff_path)) | 377 os.path.relpath(diff_path)) |
378 if len(self.build_archives) == 2: | 378 if len(self.build_archives) == 2: |
379 supersize_path = os.path.join(_BINARY_SIZE_DIR, 'supersize') | 379 supersize_path = os.path.join(_BINARY_SIZE_DIR, 'supersize') |
380 size_paths = [os.path.join(a.dir, a.build.size_name) | 380 size_paths = [os.path.join(a.dir, a.build.size_name) |
381 for a in self.build_archives] | 381 for a in self.build_archives] |
382 logging.info('Enter supersize console via: %s, console %s %s', | 382 logging.info('Enter supersize console via: %s console %s %s', |
383 os.path.relpath(supersize_path), | 383 os.path.relpath(supersize_path), |
384 os.path.relpath(size_paths[0]), | 384 os.path.relpath(size_paths[0]), |
385 os.path.relpath(size_paths[1])) | 385 os.path.relpath(size_paths[1])) |
386 metadata.Write() | 386 metadata.Write() |
387 self._AddDiffSummaryStat(before, after) | 387 self._AddDiffSummaryStat(before, after) |
388 | 388 |
389 def Summarize(self): | 389 def Summarize(self): |
390 if self._summary_stats: | 390 if self._summary_stats: |
391 path = os.path.join(self.archive_dir, 'last_diff_summary.txt') | 391 path = os.path.join(self.archive_dir, 'last_diff_summary.txt') |
392 with open(path, 'w') as f: | 392 with open(path, 'w') as f: |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 819 |
820 if i != 0: | 820 if i != 0: |
821 diff_mngr.MaybeDiff(i - 1, i) | 821 diff_mngr.MaybeDiff(i - 1, i) |
822 | 822 |
823 diff_mngr.Summarize() | 823 diff_mngr.Summarize() |
824 | 824 |
825 | 825 |
826 if __name__ == '__main__': | 826 if __name__ == '__main__': |
827 sys.exit(main()) | 827 sys.exit(main()) |
828 | 828 |
OLD | NEW |