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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 if regex_results: | 495 if regex_results: |
496 page_names = regex_results.group('values') | 496 page_names = regex_results.group('values') |
497 page_names = page_names.split(',') | 497 page_names = page_names.split(',') |
498 | 498 |
499 if not metric == ['times', 't'] or not page_names: | 499 if not metric == ['times', 't'] or not page_names: |
500 values_dict['%s: %s' % (metric[0], metric[1])] = values_list | 500 values_dict['%s: %s' % (metric[0], metric[1])] = values_list |
501 else: | 501 else: |
502 if not (len(values_list) % len(page_names)): | 502 if not (len(values_list) % len(page_names)): |
503 values_dict = dict([(k, []) for k in page_names]) | 503 values_dict = dict([(k, []) for k in page_names]) |
504 | 504 |
505 num = len(values_list) / len(page_names) | 505 # In the case of times/t, values_list is an array of times in the |
| 506 # order of page_names, repeated X number of times. |
| 507 # ie. |
| 508 # page_names = ['www.chromium.org', 'dev.chromium.org'] |
| 509 # values_list = [1, 2, 1, 2, 1, 2] |
| 510 num_pages = len(page_names) |
506 | 511 |
507 for j in xrange(num): | 512 for i in xrange(len(values_list)): |
508 for i in xrange(len(page_names)): | 513 page_index = i % num_pages |
509 k = num * j + i | 514 |
510 values_dict[page_names[i]].append(values_list[k]) | 515 values_dict[page_names[page_index]].append(values_list[i]) |
511 | 516 |
512 return values_dict | 517 return values_dict |
513 | 518 |
514 def RunPerformanceTestAndParseResults(self, command_to_run, metric): | 519 def RunPerformanceTestAndParseResults(self, command_to_run, metric): |
515 """Runs a performance test on the current revision by executing the | 520 """Runs a performance test on the current revision by executing the |
516 'command_to_run' and parses the results. | 521 'command_to_run' and parses the results. |
517 | 522 |
518 Args: | 523 Args: |
519 command_to_run: The command to be run to execute the performance test. | 524 command_to_run: The command to be run to execute the performance test. |
520 metric: The metric to parse out from the results of the performance test. | 525 metric: The metric to parse out from the results of the performance test. |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 if not(bisect_results['error']): | 1238 if not(bisect_results['error']): |
1234 bisect_test.FormatAndPrintResults(bisect_results) | 1239 bisect_test.FormatAndPrintResults(bisect_results) |
1235 return 0 | 1240 return 0 |
1236 else: | 1241 else: |
1237 print 'Error: ' + bisect_results['error'] | 1242 print 'Error: ' + bisect_results['error'] |
1238 print | 1243 print |
1239 return 1 | 1244 return 1 |
1240 | 1245 |
1241 if __name__ == '__main__': | 1246 if __name__ == '__main__': |
1242 sys.exit(main()) | 1247 sys.exit(main()) |
OLD | NEW |