Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """Performance Test Bisect Tool | 6 """Performance Test Bisect Tool |
| 7 | 7 |
| 8 This script bisects a series of changelists using binary search. It starts at | 8 This script bisects a series of changelists using binary search. It starts at |
| 9 a bad revision where a performance metric has regressed, and asks for a last | 9 a bad revision where a performance metric has regressed, and asks for a last |
| 10 known-good revision. It will then binary search across this revision range by | 10 known-good revision. It will then binary search across this revision range by |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1309 | 1309 |
| 1310 def PostBuildRequestAndWait(self, revision, fetch_build, patch=None): | 1310 def PostBuildRequestAndWait(self, revision, fetch_build, patch=None): |
| 1311 """POSTs the build request job to the try server instance. | 1311 """POSTs the build request job to the try server instance. |
| 1312 | 1312 |
| 1313 A try job build request is posted to tryserver.chromium.perf master, | 1313 A try job build request is posted to tryserver.chromium.perf master, |
| 1314 and waits for the binaries to be produced and archived on cloud storage. | 1314 and waits for the binaries to be produced and archived on cloud storage. |
| 1315 Once the build is ready and stored onto cloud, build archive is downloaded | 1315 Once the build is ready and stored onto cloud, build archive is downloaded |
| 1316 into the output folder. | 1316 into the output folder. |
| 1317 | 1317 |
| 1318 Args: | 1318 Args: |
| 1319 revision: A Git hash revision. | 1319 revision: A Git hash revision. |
|
qyearsley
2014/08/27 16:41:55
I think it would be less confusing if this were ca
prasadv
2014/08/27 17:15:39
Done.
| |
| 1320 fetch_build: Function to check and download build from cloud storage. | 1320 fetch_build: Function to check and download build from cloud storage. |
| 1321 patch: A DEPS patch (used while bisecting 3rd party repositories). | 1321 patch: A DEPS patch (used while bisecting 3rd party repositories). |
| 1322 | 1322 |
| 1323 Returns: | 1323 Returns: |
| 1324 Downloaded archive file path when requested build exists and download is | 1324 Downloaded archive file path when requested build exists and download is |
| 1325 successful, otherwise None. | 1325 successful, otherwise None. |
| 1326 """ | 1326 """ |
| 1327 # Get SVN revision for the given SHA. | 1327 # Get SVN revision for the given SHA. |
| 1328 svn_revision = self.source_control.SVNFindRev(revision) | 1328 svn_revision = self.source_control.SVNFindRev(revision) |
| 1329 if not svn_revision: | 1329 if not svn_revision: |
| 1330 raise RuntimeError( | 1330 raise RuntimeError( |
| 1331 'Failed to determine SVN revision for %s' % revision) | 1331 'Failed to determine SVN revision for %s' % revision) |
|
qyearsley
2014/08/27 16:41:55
We don't need to do this now, right?
prasadv
2014/08/27 17:15:39
I felt SVN or Commit position are more readable ra
qyearsley
2014/08/27 17:58:24
Now, the function SVNFindRev might also find git c
| |
| 1332 | 1332 |
| 1333 def GetBuilderNameAndBuildTime(target_platform, target_arch='ia32'): | 1333 def GetBuilderNameAndBuildTime(target_platform, target_arch='ia32'): |
| 1334 """Gets builder bot name and build time in seconds based on platform.""" | 1334 """Gets builder bot name and build time in seconds based on platform.""" |
| 1335 # Bot names should match the one listed in tryserver.chromium's | 1335 # Bot names should match the one listed in tryserver.chromium's |
| 1336 # master.cfg which produces builds for bisect. | 1336 # master.cfg which produces builds for bisect. |
| 1337 if bisect_utils.IsWindowsHost(): | 1337 if bisect_utils.IsWindowsHost(): |
| 1338 if bisect_utils.Is64BitWindows() and target_arch == 'x64': | 1338 if bisect_utils.Is64BitWindows() and target_arch == 'x64': |
| 1339 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME) | 1339 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME) |
| 1340 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME) | 1340 return ('win_perf_bisect_builder', MAX_WIN_BUILD_TIME) |
| 1341 if bisect_utils.IsLinuxHost(): | 1341 if bisect_utils.IsLinuxHost(): |
| 1342 if target_platform == 'android': | 1342 if target_platform == 'android': |
| 1343 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) | 1343 return ('android_perf_bisect_builder', MAX_LINUX_BUILD_TIME) |
| 1344 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) | 1344 return ('linux_perf_bisect_builder', MAX_LINUX_BUILD_TIME) |
| 1345 if bisect_utils.IsMacHost(): | 1345 if bisect_utils.IsMacHost(): |
| 1346 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) | 1346 return ('mac_perf_bisect_builder', MAX_MAC_BUILD_TIME) |
| 1347 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) | 1347 raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) |
| 1348 if not fetch_build: | 1348 if not fetch_build: |
| 1349 return False | 1349 return False |
| 1350 | 1350 |
| 1351 bot_name, build_timeout = GetBuilderNameAndBuildTime( | 1351 bot_name, build_timeout = GetBuilderNameAndBuildTime( |
| 1352 self.opts.target_platform, self.opts.target_arch) | 1352 self.opts.target_platform, self.opts.target_arch) |
| 1353 builder_host = self.opts.builder_host | 1353 builder_host = self.opts.builder_host |
| 1354 builder_port = self.opts.builder_port | 1354 builder_port = self.opts.builder_port |
| 1355 # Create a unique ID for each build request posted to try server builders. | 1355 # Create a unique ID for each build request posted to try server builders. |
| 1356 # This ID is added to "Reason" property of the build. | 1356 # This ID is added to "Reason" property of the build. |
| 1357 build_request_id = GetSHA1HexDigest( | 1357 build_request_id = GetSHA1HexDigest( |
| 1358 '%s-%s-%s' % (svn_revision, patch, time.time())) | 1358 '%s-%s-%s' % (svn_revision, patch, time.time())) |
|
qyearsley
2014/08/27 16:41:55
Perhaps the build ID request should use the git ha
| |
| 1359 | 1359 |
| 1360 # Creates a try job description. | 1360 # Creates a try job description. |
| 1361 # Always use Git hash to post build request since Commit positions are | |
| 1362 # not supported by builders to build. | |
| 1361 job_args = { | 1363 job_args = { |
| 1362 'revision': 'src@%s' % svn_revision, | 1364 'revision': 'src@%s' % revision, |
| 1363 'bot': bot_name, | 1365 'bot': bot_name, |
| 1364 'name': build_request_id, | 1366 'name': build_request_id, |
| 1365 } | 1367 } |
| 1366 # Update patch information if supplied. | 1368 # Update patch information if supplied. |
| 1367 if patch: | 1369 if patch: |
| 1368 job_args['patch'] = patch | 1370 job_args['patch'] = patch |
| 1369 # Posts job to build the revision on the server. | 1371 # Posts job to build the revision on the server. |
| 1370 if bisect_builder.PostTryJob(builder_host, builder_port, job_args): | 1372 if bisect_builder.PostTryJob(builder_host, builder_port, job_args): |
| 1371 target_file, error_msg = _WaitUntilBuildIsReady( | 1373 target_file, error_msg = _WaitUntilBuildIsReady( |
| 1372 fetch_build, bot_name, builder_host, builder_port, build_request_id, | 1374 fetch_build, bot_name, builder_host, builder_port, build_request_id, |
| 1373 build_timeout) | 1375 build_timeout) |
| 1374 if not target_file: | 1376 if not target_file: |
| 1375 print '%s [revision: %s]' % (error_msg, svn_revision) | 1377 print '%s [revision: %s]' % (error_msg, svn_revision) |
|
qyearsley
2014/08/27 16:41:55
Git hash can be printed here.
| |
| 1376 return None | 1378 return None |
| 1377 return target_file | 1379 return target_file |
| 1378 print 'Failed to post build request for revision: [%s]' % svn_revision | 1380 print 'Failed to post build request for revision: [%s]' % svn_revision |
|
qyearsley
2014/08/27 16:41:55
And here.
| |
| 1379 return None | 1381 return None |
| 1380 | 1382 |
| 1381 def IsDownloadable(self, depot): | 1383 def IsDownloadable(self, depot): |
| 1382 """Checks if build can be downloaded based on target platform and depot.""" | 1384 """Checks if build can be downloaded based on target platform and depot.""" |
| 1383 if (self.opts.target_platform in ['chromium', 'android'] and | 1385 if (self.opts.target_platform in ['chromium', 'android'] and |
| 1384 self.opts.gs_bucket): | 1386 self.opts.gs_bucket): |
| 1385 return (depot == 'chromium' or | 1387 return (depot == 'chromium' or |
| 1386 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or | 1388 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or |
| 1387 'v8' in DEPOT_DEPS_NAME[depot]['from']) | 1389 'v8' in DEPOT_DEPS_NAME[depot]['from']) |
| 1388 return False | 1390 return False |
| (...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3362 # bugs. If you change this, please update the perf dashboard as well. | 3364 # bugs. If you change this, please update the perf dashboard as well. |
| 3363 bisect_utils.OutputAnnotationStepStart('Results') | 3365 bisect_utils.OutputAnnotationStepStart('Results') |
| 3364 print 'Error: %s' % e.message | 3366 print 'Error: %s' % e.message |
| 3365 if opts.output_buildbot_annotations: | 3367 if opts.output_buildbot_annotations: |
| 3366 bisect_utils.OutputAnnotationStepClosed() | 3368 bisect_utils.OutputAnnotationStepClosed() |
| 3367 return 1 | 3369 return 1 |
| 3368 | 3370 |
| 3369 | 3371 |
| 3370 if __name__ == '__main__': | 3372 if __name__ == '__main__': |
| 3371 sys.exit(main()) | 3373 sys.exit(main()) |
| OLD | NEW |