| 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 """Merge the PGC files generated during the profiling step to the PGD database. | 6 """Merge the PGC files generated during the profiling step to the PGD database. |
| 7 | 7 |
| 8 This is required to workaround a flakyness in pgomgr.exe where it can run out | 8 This is required to workaround a flakyness in pgomgr.exe where it can run out |
| 9 of address space while trying to merge all the PGC files at the same time. | 9 of address space while trying to merge all the PGC files at the same time. |
| 10 """ | 10 """ |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 os.path.join(options.build_dir, os.path.basename(pgc_file))) | 123 os.path.join(options.build_dir, os.path.basename(pgc_file))) |
| 124 ret = merge_pgc_files(pgomgr_path, files_to_merge, pgd_file) | 124 ret = merge_pgc_files(pgomgr_path, files_to_merge, pgd_file) |
| 125 # pgomgr.exe sometimes fails to merge too many files at the same time (it | 125 # pgomgr.exe sometimes fails to merge too many files at the same time (it |
| 126 # usually complains that a stream is missing, but if you try to merge this | 126 # usually complains that a stream is missing, but if you try to merge this |
| 127 # file individually it works), try to merge all the PGCs from this batch one | 127 # file individually it works), try to merge all the PGCs from this batch one |
| 128 # at a time instead. Don't fail the build if we can't merge a file. | 128 # at a time instead. Don't fail the build if we can't merge a file. |
| 129 # TODO(sebmarchand): Report this to Microsoft, check if this is still | 129 # TODO(sebmarchand): Report this to Microsoft, check if this is still |
| 130 # happening with VS2017. | 130 # happening with VS2017. |
| 131 if ret != 0: | 131 if ret != 0: |
| 132 print ('Error while trying to merge several PGC files at the same time, ' | 132 print ('Error while trying to merge several PGC files at the same time, ' |
| 133 'trying to merge them one by one.' | 133 'trying to merge them one by one.') |
| 134 for pgc_file in chunk: | 134 for pgc_file in chunk: |
| 135 ret = merge_pgc_files( | 135 ret = merge_pgc_files( |
| 136 pgomgr_path, | 136 pgomgr_path, |
| 137 [os.path.join(options.build_dir, os.path.basename(pgc_file))], | 137 [os.path.join(options.build_dir, os.path.basename(pgc_file))], |
| 138 pgd_file | 138 pgd_file |
| 139 ) | 139 ) |
| 140 if ret != 0: | 140 if ret != 0: |
| 141 print 'Error while trying to merge %s, continuing.' % pgc_file | 141 print 'Error while trying to merge %s, continuing.' % pgc_file |
| 142 | 142 |
| 143 | 143 |
| 144 if __name__ == '__main__': | 144 if __name__ == '__main__': |
| 145 sys.exit(main()) | 145 sys.exit(main()) |
| OLD | NEW |