Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: tools/testing/perf_testing/run_perf_tests.py

Issue 9910026: Improve invalid file handling and command line options for perf script. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 import datetime 7 import datetime
8 import getpass 8 import getpass
9 import math 9 import math
10 from matplotlib.font_manager import FontProperties 10 from matplotlib.font_manager import FontProperties
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 geo_mean += math.log(self.values_dict[platform][frog_or_v8][benchmark][ 338 geo_mean += math.log(self.values_dict[platform][frog_or_v8][benchmark][
339 len(self.values_dict[platform][frog_or_v8][benchmark]) - 1]) 339 len(self.values_dict[platform][frog_or_v8][benchmark]) - 1])
340 340
341 mean = JS_MEAN 341 mean = JS_MEAN
342 if frog_or_v8 == FROG: 342 if frog_or_v8 == FROG:
343 mean = FROG_MEAN 343 mean = FROG_MEAN
344 self.values_dict[platform][frog_or_v8][mean] += \ 344 self.values_dict[platform][frog_or_v8][mean] += \
345 [math.pow(math.e, geo_mean / len(get_benchmarks()))] 345 [math.pow(math.e, geo_mean / len(get_benchmarks()))]
346 self.revision_dict[platform][frog_or_v8][mean] += [svn_revision] 346 self.revision_dict[platform][frog_or_v8][mean] += [svn_revision]
347 347
348 def run(self): 348 def run(self, graph_only):
349 """Run the benchmarks/tests from the command line and plot the 349 """Run the benchmarks/tests from the command line and plot the
350 results.""" 350 results."""
351 plt.cla() # cla = clear current axes 351 plt.cla() # cla = clear current axes
352 os.chdir(DART_INSTALL_LOCATION) 352 os.chdir(DART_INSTALL_LOCATION)
353 ensure_output_directory(self.result_folder_name) 353 ensure_output_directory(self.result_folder_name)
354 ensure_output_directory(GRAPH_OUT_DIR) 354 ensure_output_directory(GRAPH_OUT_DIR)
355 self.run_tests() 355 if not graph_only:
356 self.run_tests()
356 357
357 os.chdir(os.path.join('tools', 'testing', 'perf_testing')) 358 os.chdir(os.path.join('tools', 'testing', 'perf_testing'))
358 359
359 # TODO(efortuna): You will want to make this only use a subset of the files 360 # TODO(efortuna): You will want to make this only use a subset of the files
360 # eventually. 361 # eventually.
361 files = os.listdir(self.result_folder_name) 362 files = os.listdir(self.result_folder_name)
362 363
363 for afile in files: 364 for afile in files:
364 if not afile.startswith('.'): 365 if not afile.startswith('.'):
365 self.process_file(afile) 366 self.process_file(afile)
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 if 'will be skipped' in line: 579 if 'will be skipped' in line:
579 total_tests -= int(line.split()[1]) 580 total_tests -= int(line.split()[1])
580 if 'we should fix' in line: 581 if 'we should fix' in line:
581 expect_fail += int(line.split()[1]) 582 expect_fail += int(line.split()[1])
582 if 'Revision' in line: 583 if 'Revision' in line:
583 revision_num = int(line.split()[1]) 584 revision_num = int(line.split()[1])
584 if '--- TIMEOUT ---' in line or 'FAIL:' in line or 'PASS' in line: 585 if '--- TIMEOUT ---' in line or 'FAIL:' in line or 'PASS' in line:
585 # (A printed out 'PASS' indicates we incorrectly passed a negative 586 # (A printed out 'PASS' indicates we incorrectly passed a negative
586 # test.) 587 # test.)
587 num_failed += 1 588 num_failed += 1
588 589
589 self.revision_dict[browser][FROG][CORRECTNESS] += [revision_num] 590 if total_tests != 0:
590 self.values_dict[browser][FROG][CORRECTNESS] += [100.0 * 591 # If we have an improperly formatted file, don't use the data.
591 (((float)(total_tests - (expect_fail + num_failed))) /total_tests)] 592 self.revision_dict[browser][FROG][CORRECTNESS] += [revision_num]
593 self.values_dict[browser][FROG][CORRECTNESS] += [100.0 *
594 (((float)(total_tests - (expect_fail + num_failed))) /total_tests)]
592 f.close() 595 f.close()
593 596
594 def plot_results(self, png_filename): 597 def plot_results(self, png_filename):
595 first_time = True 598 first_time = True
596 for browser in get_browsers(): 599 for browser in get_browsers():
597 self.style_and_save_perf_plot('Percentage of language tests passing in ' 600 self.style_and_save_perf_plot('Percentage of language tests passing in '
598 'different browsers', '% of tests passed', 8, 8, 'lower left', 601 'different browsers', '% of tests passed', 8, 8, 'lower left',
599 png_filename, [browser], [FROG], [CORRECTNESS], first_time) 602 png_filename, [browser], [FROG], [CORRECTNESS], first_time)
600 first_time = False 603 first_time = False
601 604
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 parser.add_option('--size-time', '-s', dest='size', 719 parser.add_option('--size-time', '-s', dest='size',
717 help='Run the code size and timing tests', 720 help='Run the code size and timing tests',
718 action='store_true', default=False) 721 action='store_true', default=False)
719 parser.add_option('--language', '-l', dest='language', 722 parser.add_option('--language', '-l', dest='language',
720 help='Run the language correctness tests', 723 help='Run the language correctness tests',
721 action='store_true', default=False) 724 action='store_true', default=False)
722 parser.add_option('--browser-perf', '-b', dest='perf', 725 parser.add_option('--browser-perf', '-b', dest='perf',
723 help='Run the browser performance tests', 726 help='Run the browser performance tests',
724 action='store_true', default=False) 727 action='store_true', default=False)
725 parser.add_option('--forever', '-f', dest='continuous', 728 parser.add_option('--forever', '-f', dest='continuous',
726 help = 'Run this script forever, always checking for the next svn ' 729 help='Run this script forever, always checking for the next svn '
727 'checkin', action='store_true', default=False) 730 'checkin', action='store_true', default=False)
728 parser.add_option('--verbose', '-v', dest='verbose', 731 parser.add_option('--verbose', '-v', dest='verbose',
729 help = 'Print extra debug output', action='store_true', default=False) 732 help='Print extra debug output', action='store_true', default=False)
733 parser.add_option('--nobuild', '-n', dest='no_build', action='store_true',
734 help='Do not sync with the repository and do not rebuild.', default=False)
735 parser.add_option('--graph-only', '-g', dest='graph_only', default=False,
736 help='Do not run tests, only regenerate graphs', action='store_true')
730 parser.add_option('--user', '-u', dest='username', 737 parser.add_option('--user', '-u', dest='username',
731 help='Username for submitting new data to App Engine', default='') 738 help='Username for submitting new data to App Engine', default='')
732 739
733 args, ignored = parser.parse_args() 740 args, ignored = parser.parse_args()
734 password = '' 741 password = ''
735 if args.username != '': 742 if args.username != '':
736 password = getpass.getpass("App Engine Password: ") 743 password = getpass.getpass("App Engine Password: ")
737 else: 744 else:
738 print 'Warning: performance data will not be uploaded to App Engine' + \ 745 print 'Warning: performance data will not be uploaded to App Engine' + \
739 ' if you do not provide a username.' 746 ' if you do not provide a username.'
740 if not (args.cl or args.size or args.language or args.perf): 747 if not (args.cl or args.size or args.language or args.perf):
741 args.cl = args.size = args.language = args.perf = True 748 args.cl = args.size = args.language = args.perf = True
742 return (args.cl, args.size, args.language, args.perf, args.continuous, 749 return (args.cl, args.size, args.language, args.perf, args.continuous,
743 args.verbose, args.username, password) 750 args.verbose, args.no_build, args.graph_only, args.username, password)
744 751
745 def run_test_sequence(cl, size, language, perf, username, password): 752 def run_test_sequence(cl, size, language, perf, no_build, graph_only,
753 username, password):
746 # The buildbot already builds and syncs to a specific revision. Don't fight 754 # The buildbot already builds and syncs to a specific revision. Don't fight
747 # with it or replicate work. 755 # with it or replicate work.
748 if sync_and_build() == 1: 756 if (not no_build or not graph_only) and sync_and_build() == 1:
749 return # The build is broken. 757 return # The build is broken.
750 if size: 758 if size:
751 CompileTimeAndSizeTest(TIME_SIZE).run() 759 CompileTimeAndSizeTest(TIME_SIZE).run(graph_only)
752 if cl: 760 if cl:
753 CommandLinePerformanceTest(CL_PERF).run() 761 CommandLinePerformanceTest(CL_PERF).run(graph_only)
754 if language: 762 if language:
755 BrowserCorrectnessTest('language', BROWSER_CORRECTNESS).run() 763 BrowserCorrectnessTest('language', BROWSER_CORRECTNESS).run(graph_only)
756 if perf: 764 if perf:
757 BrowserPerformanceTest(BROWSER_PERF).run() 765 BrowserPerformanceTest(BROWSER_PERF).run(graph_only)
758 766
759 if username != '': 767 if username != '':
760 upload_to_app_engine(username, password) 768 upload_to_app_engine(username, password)
761 769
762 def main(): 770 def main():
763 global VERBOSE 771 global VERBOSE
764 (cl, size, language, perf, continuous, verbose, username, password) = parse_ar gs() 772 (cl, size, language, perf, continuous, verbose, no_build, graph_only,
773 username, password) = parse_args()
765 VERBOSE = verbose 774 VERBOSE = verbose
766 if continuous: 775 if continuous:
767 while True: 776 while True:
768 if has_new_code(): 777 if has_new_code():
769 run_test_sequence(cl, size, language, perf, username, password) 778 run_test_sequence(cl, size, language, perf, no_build, graph_only,
779 username, password)
770 else: 780 else:
771 time.sleep(SLEEP_TIME) 781 time.sleep(SLEEP_TIME)
772 else: 782 else:
773 run_test_sequence(cl, size, language, perf, username, password) 783 run_test_sequence(cl, size, language, perf, no_build, graph_only,
784 username, password)
774 785
775 if __name__ == '__main__': 786 if __name__ == '__main__':
776 main() 787 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698