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

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

Issue 10360004: Make change to actually upload to app engine. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 math 8 import math
9 try: 9 try:
10 from matplotlib.font_manager import FontProperties 10 from matplotlib.font_manager import FontProperties
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 suites = [] 265 suites = []
266 for name in self.suite_names: 266 for name in self.suite_names:
267 suites += [TestBuilder.make_test(name, self)] 267 suites += [TestBuilder.make_test(name, self)]
268 268
269 if not self.no_build and self.sync_and_build(suites) == 1: 269 if not self.no_build and self.sync_and_build(suites) == 1:
270 return # The build is broken. 270 return # The build is broken.
271 271
272 for test in suites: 272 for test in suites:
273 test.run() 273 test.run()
274 274
275 if not self.no_upload:
276 self.upload_to_app_engine(TestBuilder.available_suite_names())
277
275 278
276 class Test(object): 279 class Test(object):
277 """The base class to provide shared code for different tests we will run and 280 """The base class to provide shared code for different tests we will run and
278 graph. At a high level, each test has three visitors (the tester, the 281 graph. At a high level, each test has three visitors (the tester, the
279 file_processor and the grapher) that perform operations on the test object.""" 282 file_processor and the grapher) that perform operations on the test object."""
280 283
281 def __init__(self, result_folder_name, platform_list, variants, 284 def __init__(self, result_folder_name, platform_list, variants,
282 values_list, test_runner, tester, file_processor, grapher, 285 values_list, test_runner, tester, file_processor, grapher,
283 extra_metrics=['Geo-Mean'], build_targets=['create_sdk']): 286 extra_metrics=['Geo-Mean'], build_targets=['create_sdk']):
284 """Args: 287 """Args:
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 '--timeout', '600', '--mode', 'perf'], self.test.trace_file, 680 '--timeout', '600', '--mode', 'perf'], self.test.trace_file,
678 append=True) 681 append=True)
679 682
680 class CommonBrowserFileProcessor(Processor): 683 class CommonBrowserFileProcessor(Processor):
681 def process_file(self, afile): 684 def process_file(self, afile):
682 """Comb through the html to find the performance results. 685 """Comb through the html to find the performance results.
683 Returns: True if we successfully posted our data to storage and/or we can 686 Returns: True if we successfully posted our data to storage and/or we can
684 delete the trace file.""" 687 delete the trace file."""
685 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 688 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools',
686 'testing', 'perf_testing')) 689 'testing', 'perf_testing'))
687 if self.test.test_runner.no_upload:
688 return
689 parts = afile.split('-') 690 parts = afile.split('-')
690 browser = parts[2] 691 browser = parts[2]
691 version = parts[3] 692 version = parts[3]
692 f = open(os.path.join(self.test.result_folder_name, afile)) 693 f = open(os.path.join(self.test.result_folder_name, afile))
693 lines = f.readlines() 694 lines = f.readlines()
694 line = '' 695 line = ''
695 i = 0 696 i = 0
696 revision_num = 0 697 revision_num = 0
697 while '<div id="results">' not in line and i < len(lines): 698 while '<div id="results">' not in line and i < len(lines):
698 if 'Revision' in line: 699 if 'Revision' in line:
(...skipping 19 matching lines...) Expand all
718 name_and_score = result.split(':') 719 name_and_score = result.split(':')
719 if len(name_and_score) < 2: 720 if len(name_and_score) < 2:
720 break 721 break
721 name = name_and_score[0].strip() 722 name = name_and_score[0].strip()
722 score = name_and_score[1].strip() 723 score = name_and_score[1].strip()
723 if version == 'js' or version == 'v8': 724 if version == 'js' or version == 'v8':
724 version = 'js' 725 version = 'js'
725 bench_dict = self.test.values_dict[browser][version] 726 bench_dict = self.test.values_dict[browser][version]
726 bench_dict[name] += [float(score)] 727 bench_dict[name] += [float(score)]
727 self.test.revision_dict[browser][version][name] += [revision_num] 728 self.test.revision_dict[browser][version][name] += [revision_num]
728 if self.should_report_results(afile): 729 if self.should_report_results(afile) and \
730 not self.test.test_runner.no_upload:
729 upload_success = upload_success and self.report_results( 731 upload_success = upload_success and self.report_results(
730 name, score, browser, version, revision_num, self.SCORE) 732 name, score, browser, version, revision_num, self.SCORE)
731 else: 733 else:
732 upload_success = False 734 upload_success = False
733 735
734 f.close() 736 f.close()
735 self.calculate_geometric_mean(browser, version, revision_num) 737 self.calculate_geometric_mean(browser, version, revision_num)
736 return upload_success 738 return upload_success
737 739
738 740
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 version = version.replace('frog', 'dart') 866 version = version.replace('frog', 'dart')
865 version = version.replace('_','&') 867 version = version.replace('_','&')
866 tags = DromaeoTester.get_valid_dromaeo_tags() 868 tags = DromaeoTester.get_valid_dromaeo_tags()
867 return '|'.join([ '%s&%s' % (version, tag) for tag in tags]) 869 return '|'.join([ '%s&%s' % (version, tag) for tag in tags])
868 870
869 871
870 class DromaeoFileProcessor(Processor): 872 class DromaeoFileProcessor(Processor):
871 def process_file(self, afile): 873 def process_file(self, afile):
872 """Comb through the html to find the performance results. 874 """Comb through the html to find the performance results.
873 Returns: True if we successfully posted our data to storage.""" 875 Returns: True if we successfully posted our data to storage."""
874 if self.test.test_runner.no_upload:
875 return
876 parts = afile.split('-') 876 parts = afile.split('-')
877 browser = parts[2] 877 browser = parts[2]
878 version = parts[3] 878 version = parts[3]
879 879
880 bench_dict = self.test.values_dict[browser][version] 880 bench_dict = self.test.values_dict[browser][version]
881 881
882 f = open(os.path.join(self.test.result_folder_name, afile)) 882 f = open(os.path.join(self.test.result_folder_name, afile))
883 lines = f.readlines() 883 lines = f.readlines()
884 i = 0 884 i = 0
885 revision_num = 0 885 revision_num = 0
(...skipping 13 matching lines...) Expand all
899 for suite_result in suite_results: 899 for suite_result in suite_results:
900 results = re.findall(r'<li>(.*?)</li>', suite_result) 900 results = re.findall(r'<li>(.*?)</li>', suite_result)
901 if results: 901 if results:
902 for result in results: 902 for result in results:
903 r = re.match(result_pattern, result) 903 r = re.match(result_pattern, result)
904 name = DromaeoTester.legalize_filename(r.group(1).strip(':')) 904 name = DromaeoTester.legalize_filename(r.group(1).strip(':'))
905 score = float(r.group(2)) 905 score = float(r.group(2))
906 bench_dict[name] += [float(score)] 906 bench_dict[name] += [float(score)]
907 self.test.revision_dict[browser][version][name] += \ 907 self.test.revision_dict[browser][version][name] += \
908 [revision_num] 908 [revision_num]
909 if self.should_report_results(afile): 909 if self.should_report_results(afile) and \
910 not self.test.test_runner.no_upload:
910 upload_success = upload_success and self.report_results( 911 upload_success = upload_success and self.report_results(
911 name, score, browser, version, revision_num, self.SCORE) 912 name, score, browser, version, revision_num, self.SCORE)
912 else: 913 else:
913 upload_success = False 914 upload_success = False
914 915
915 f.close() 916 f.close()
916 self.calculate_geometric_mean(browser, version, revision_num) 917 self.calculate_geometric_mean(browser, version, revision_num)
917 return upload_success 918 return upload_success
918 919
919 920
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1001
1001 class DromaeoSizeProcessor(Processor): 1002 class DromaeoSizeProcessor(Processor):
1002 def process_file(self, afile): 1003 def process_file(self, afile):
1003 """Pull all the relevant information out of a given tracefile. 1004 """Pull all the relevant information out of a given tracefile.
1004 1005
1005 Args: 1006 Args:
1006 afile: is the filename string we will be processing. 1007 afile: is the filename string we will be processing.
1007 Returns: True if we successfully posted our data to storage.""" 1008 Returns: True if we successfully posted our data to storage."""
1008 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 1009 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools',
1009 'testing', 'perf_testing')) 1010 'testing', 'perf_testing'))
1010 if self.test.test_runner.no_upload:
1011 return
1012 f = open(os.path.join(self.test.result_folder_name, afile)) 1011 f = open(os.path.join(self.test.result_folder_name, afile))
1013 tabulate_data = False 1012 tabulate_data = False
1014 revision_num = 0 1013 revision_num = 0
1015 revision_pattern = r'Revision: (\d+)' 1014 revision_pattern = r'Revision: (\d+)'
1016 result_pattern = r'Size \((\w+), ([a-zA-Z0-9-]+)\): (\d+)' 1015 result_pattern = r'Size \((\w+), ([a-zA-Z0-9-]+)\): (\d+)'
1017 1016
1018 upload_success = True 1017 upload_success = True
1019 for line in f.readlines(): 1018 for line in f.readlines():
1020 rev = re.match(revision_pattern, line.strip()) 1019 rev = re.match(revision_pattern, line.strip())
1021 if rev: 1020 if rev:
1022 revision_num = int(rev.group(1)) 1021 revision_num = int(rev.group(1))
1023 continue 1022 continue
1024 1023
1025 result = re.match(result_pattern, line.strip()) 1024 result = re.match(result_pattern, line.strip())
1026 if result: 1025 if result:
1027 variant = result.group(1) 1026 variant = result.group(1)
1028 metric = result.group(2) 1027 metric = result.group(2)
1029 num = result.group(3) 1028 num = result.group(3)
1030 if num.find('.') == -1: 1029 if num.find('.') == -1:
1031 num = int(num) 1030 num = int(num)
1032 else: 1031 else:
1033 num = float(num) 1032 num = float(num)
1034 self.test.values_dict['commandline'][variant][metric] += [num] 1033 self.test.values_dict['commandline'][variant][metric] += [num]
1035 self.test.revision_dict['commandline'][variant][metric] += \ 1034 self.test.revision_dict['commandline'][variant][metric] += \
1036 [revision_num] 1035 [revision_num]
1037 if self.should_report_results(afile): 1036 if self.should_report_results(afile) and \
1037 not self.test.test_runner.no_upload:
1038 upload_success = upload_success and self.report_results( 1038 upload_success = upload_success and self.report_results(
1039 metric, num, 'commandline', variant, revision_num, 1039 metric, num, 'commandline', variant, revision_num,
1040 self.CODE_SIZE) 1040 self.CODE_SIZE)
1041 else: 1041 else:
1042 upload_success = False 1042 upload_success = False
1043 1043
1044 f.close() 1044 f.close()
1045 return upload_success 1045 return upload_success
1046 1046
1047 class DromaeoSizeGrapher(Grapher): 1047 class DromaeoSizeGrapher(Grapher):
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 class CompileProcessor(Processor): 1130 class CompileProcessor(Processor):
1131 1131
1132 def process_file(self, afile): 1132 def process_file(self, afile):
1133 """Pull all the relevant information out of a given tracefile. 1133 """Pull all the relevant information out of a given tracefile.
1134 1134
1135 Args: 1135 Args:
1136 afile: is the filename string we will be processing. 1136 afile: is the filename string we will be processing.
1137 Returns: True if we successfully posted our data to storage.""" 1137 Returns: True if we successfully posted our data to storage."""
1138 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 1138 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools',
1139 'testing', 'perf_testing')) 1139 'testing', 'perf_testing'))
1140 if self.test.test_runner.no_upload:
1141 return
1142 f = open(os.path.join(self.test.result_folder_name, afile)) 1140 f = open(os.path.join(self.test.result_folder_name, afile))
1143 tabulate_data = False 1141 tabulate_data = False
1144 revision_num = 0 1142 revision_num = 0
1145 upload_success = True 1143 upload_success = True
1146 for line in f.readlines(): 1144 for line in f.readlines():
1147 tokens = line.split() 1145 tokens = line.split()
1148 if 'Revision' in line: 1146 if 'Revision' in line:
1149 revision_num = int(line.split()[1]) 1147 revision_num = int(line.split()[1])
1150 else: 1148 else:
1151 for metric in self.test.values_list: 1149 for metric in self.test.values_list:
1152 if metric in line: 1150 if metric in line:
1153 num = tokens[0] 1151 num = tokens[0]
1154 if num.find('.') == -1: 1152 if num.find('.') == -1:
1155 num = int(num) 1153 num = int(num)
1156 else: 1154 else:
1157 num = float(num) 1155 num = float(num)
1158 self.test.values_dict['commandline']['frog'][metric] += [num] 1156 self.test.values_dict['commandline']['frog'][metric] += [num]
1159 self.test.revision_dict['commandline']['frog'][metric] += \ 1157 self.test.revision_dict['commandline']['frog'][metric] += \
1160 [revision_num] 1158 [revision_num]
1161 score_type = self.CODE_SIZE 1159 score_type = self.CODE_SIZE
1162 if 'Compiling' in metric or 'Bootstrapping' in metric: 1160 if 'Compiling' in metric or 'Bootstrapping' in metric:
1163 score_type = self.COMPILE_TIME 1161 score_type = self.COMPILE_TIME
1164 if self.should_report_results(afile): 1162 if self.should_report_results(afile) and \
1163 not self.test.test_runner.no_upload:
1164 if num < self.test.failure_threshold[metric]:
1165 num = 0
1165 upload_success = upload_success and self.report_results( 1166 upload_success = upload_success and self.report_results(
1166 metric, num, 'commandline', 'frog', revision_num, 1167 metric, num, 'commandline', 'frog', revision_num,
1167 score_type) 1168 score_type)
1168 else: 1169 else:
1169 upload_success = False 1170 upload_success = False
1170 if revision_num != 0: 1171 if revision_num != 0:
1171 for metric in self.test.values_list: 1172 for metric in self.test.values_list:
1172 self.test.revision_dict['commandline']['frog'][metric].pop() 1173 self.test.revision_dict['commandline']['frog'][metric].pop()
1173 self.test.revision_dict['commandline']['frog'][metric] += \ 1174 self.test.revision_dict['commandline']['frog'][metric] += \
1174 [revision_num] 1175 [revision_num]
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 while True: 1212 while True:
1212 if runner.has_new_code(): 1213 if runner.has_new_code():
1213 runner.run_test_sequence() 1214 runner.run_test_sequence()
1214 else: 1215 else:
1215 time.sleep(200) 1216 time.sleep(200)
1216 else: 1217 else:
1217 runner.run_test_sequence() 1218 runner.run_test_sequence()
1218 1219
1219 if __name__ == '__main__': 1220 if __name__ == '__main__':
1220 main() 1221 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