Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 to | 53 to |
| 54 append True if we want to append to the file instead of overwriting it""" | 54 append True if we want to append to the file instead of overwriting it""" |
| 55 if VERBOSE: | 55 if VERBOSE: |
| 56 print ' '.join(cmd_list) | 56 print ' '.join(cmd_list) |
| 57 out = subprocess.PIPE | 57 out = subprocess.PIPE |
| 58 if outfile: | 58 if outfile: |
| 59 mode = 'w' | 59 mode = 'w' |
| 60 if append: | 60 if append: |
| 61 mode = 'a' | 61 mode = 'a' |
| 62 out = open(outfile, mode) | 62 out = open(outfile, mode) |
| 63 p = subprocess.Popen(cmd_list, stdout = out, | 63 p = subprocess.Popen(cmd_list, stdout = out, stderr = subprocess.PIPE) |
| 64 stderr = subprocess.PIPE, close_fds=True) | |
| 65 output, not_used = p.communicate(); | 64 output, not_used = p.communicate(); |
| 66 if output: | 65 if output: |
| 67 print output | 66 print output |
| 68 return output | 67 return output |
| 69 | 68 |
| 70 def TimeCmd(cmd): | 69 def TimeCmd(cmd): |
| 71 """Determine the amount of (real) time it takes to execute a given command.""" | 70 """Determine the amount of (real) time it takes to execute a given command.""" |
| 72 start = time.time() | 71 start = time.time() |
| 73 RunCmd(cmd) | 72 RunCmd(cmd) |
| 74 return time.time() - start | 73 return time.time() - start |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 if platform.system() == 'Windows': | 139 if platform.system() == 'Windows': |
| 141 browsers += ['ie'] | 140 browsers += ['ie'] |
| 142 return browsers | 141 return browsers |
| 143 | 142 |
| 144 def GetVersions(): | 143 def GetVersions(): |
| 145 if not PERFBOT_MODE: | 144 if not PERFBOT_MODE: |
| 146 return [FROG] | 145 return [FROG] |
| 147 else: | 146 else: |
| 148 return V8_AND_FROG | 147 return V8_AND_FROG |
| 149 | 148 |
| 149 def UploadToAppEngine(): | |
| 150 """Upload our results to our appengine server.""" | |
| 151 # TODO(efortuna): This is the most basic way to get the data up | |
| 152 # for others to view. Revisit this once you're serving nicer graphs (Google | |
|
Siggi Cherem (dart-lang)
2011/12/09 01:00:17
you're -> we're? (here and below)
| |
| 153 # Chart Tools) and from multiple perfbots and once you're in a position to | |
| 154 # organize the data in a useful manner(!!). | |
| 155 os.chdir(os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing', | |
| 156 'perf_testing')) | |
| 157 shutil.rmtree(os.path.join('appengine', 'static', 'graphs'), | |
| 158 ignore_errors=True) | |
| 159 shutil.copytree('graphs', os.path.join('appengine', 'static', 'graphs')) | |
| 160 shutil.copyfile('index.html', os.path.join('appengine', 'static', | |
| 161 'index.html')) | |
| 162 RunCmd(['../../../third_party/appengine-python/1.5.4/appcfg.py', 'update', | |
| 163 'appengine/']) | |
| 164 | |
| 150 class TestRunner(object): | 165 class TestRunner(object): |
| 151 """The base clas to provide shared code for different tests we will run and | 166 """The base clas to provide shared code for different tests we will run and |
| 152 graph.""" | 167 graph.""" |
| 153 | 168 |
| 154 def __init__(self, result_folder_name, platform_list, v8_and_or_frog_list, | 169 def __init__(self, result_folder_name, platform_list, v8_and_or_frog_list, |
| 155 values_list): | 170 values_list): |
| 156 """Args: | 171 """Args: |
| 157 result_folder_name the name of the folder where a tracefile of | 172 result_folder_name the name of the folder where a tracefile of |
| 158 performance results will be stored. | 173 performance results will be stored. |
| 159 platform_list a list containing the platform(s) that our data has been | 174 platform_list a list containing the platform(s) that our data has been |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 fontP.set_size('small') | 241 fontP.set_size('small') |
| 227 plt.legend(loc=legend_loc, prop = fontP) | 242 plt.legend(loc=legend_loc, prop = fontP) |
| 228 | 243 |
| 229 fig = plt.gcf() | 244 fig = plt.gcf() |
| 230 fig.set_size_inches(size_x, size_y) | 245 fig.set_size_inches(size_x, size_y) |
| 231 fig.savefig(os.path.join(GRAPH_OUT_DIR, filename)) | 246 fig.savefig(os.path.join(GRAPH_OUT_DIR, filename)) |
| 232 | 247 |
| 233 def AddSvnRevisionToTrace(self, outfile): | 248 def AddSvnRevisionToTrace(self, outfile): |
| 234 """Add the svn version number to the provided tracefile.""" | 249 """Add the svn version number to the provided tracefile.""" |
| 235 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, | 250 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, |
| 236 stderr = subprocess.STDOUT, close_fds=True) | 251 stderr = subprocess.STDOUT) |
| 237 output, not_used = p.communicate() | 252 output, not_used = p.communicate() |
| 238 for line in output.split('\n'): | 253 for line in output.split('\n'): |
| 239 if 'Revision' in line: | 254 if 'Revision' in line: |
| 240 RunCmd(['echo', line.strip()], outfile) | 255 RunCmd(['echo', line.strip()], outfile) |
| 241 | 256 |
| 242 def WriteHtml(self, delimiter, rev_nums, label_1, dict_1, label_2, dict_2, | 257 def WriteHtml(self, delimiter, rev_nums, label_1, dict_1, label_2, dict_2, |
| 243 cleanFile=False): | 258 cleanFile=False): |
| 244 """Adds an html table to the webpage to display the data values. This method | 259 """Adds an html table to the webpage to display the data values. This method |
| 245 will be removed when we have a nicer way to display data values.""" | 260 will be removed when we have a nicer way to display data values.""" |
| 246 #TODO(efortuna): fix this. | 261 #TODO(efortuna): fix this. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 self.values_dict[platform][frog_or_v8][mean] += \ | 302 self.values_dict[platform][frog_or_v8][mean] += \ |
| 288 [math.pow(math.e, geo_mean / len(BENCHMARKS))] | 303 [math.pow(math.e, geo_mean / len(BENCHMARKS))] |
| 289 self.revision_dict[platform][frog_or_v8][mean] += [svn_revision] | 304 self.revision_dict[platform][frog_or_v8][mean] += [svn_revision] |
| 290 | 305 |
| 291 def Cleanup(self): | 306 def Cleanup(self): |
| 292 pass | 307 pass |
| 293 | 308 |
| 294 def Run(self): | 309 def Run(self): |
| 295 """Run the benchmarks/tests from the command line and plot the | 310 """Run the benchmarks/tests from the command line and plot the |
| 296 results.""" | 311 results.""" |
| 297 plt.cla() # cla = clear current axes | 312 if PERFBOT_MODE: |
| 313 plt.cla() # cla = clear current axes | |
| 298 os.chdir(DART_INSTALL_LOCATION) | 314 os.chdir(DART_INSTALL_LOCATION) |
| 299 EnsureOutputDirectory(self.result_folder_name) | 315 EnsureOutputDirectory(self.result_folder_name) |
| 300 EnsureOutputDirectory(GRAPH_OUT_DIR) | 316 EnsureOutputDirectory(GRAPH_OUT_DIR) |
| 301 self.RunTests() | 317 self.RunTests() |
| 302 os.chdir(os.path.join('tools', 'testing', 'perf_testing')) | 318 os.chdir(os.path.join('tools', 'testing', 'perf_testing')) |
| 303 | 319 |
| 304 # TODO(efortuna): You will want to make this only use a subset of the files | 320 # TODO(efortuna): You will want to make this only use a subset of the files |
| 305 # eventually. | 321 # eventually. |
| 306 files = os.listdir(self.result_folder_name) | 322 files = os.listdir(self.result_folder_name) |
| 307 | 323 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 return # The build is broken. | 715 return # The build is broken. |
| 700 if cl: | 716 if cl: |
| 701 CommandLinePerformanceTestRunner('cl-results').Run() | 717 CommandLinePerformanceTestRunner('cl-results').Run() |
| 702 if size: | 718 if size: |
| 703 CompileTimeAndSizeTestRunner('code-time-size').Run() | 719 CompileTimeAndSizeTestRunner('code-time-size').Run() |
| 704 if language: | 720 if language: |
| 705 BrowserCorrectnessTestRunner('language', 'browser-correctness').Run() | 721 BrowserCorrectnessTestRunner('language', 'browser-correctness').Run() |
| 706 if perf: | 722 if perf: |
| 707 BrowserPerformanceTestRunner('browser-perf').Run() | 723 BrowserPerformanceTestRunner('browser-perf').Run() |
| 708 | 724 |
| 725 if PERFBOT_MODE: | |
| 726 UploadToAppEngine() | |
| 727 | |
| 709 def main(): | 728 def main(): |
| 710 global PERFBOT_MODE, VERBOSE | 729 global PERFBOT_MODE, VERBOSE |
| 711 (cl, size, language, perf, continuous, perfbot, verbose) = ParseArgs() | 730 (cl, size, language, perf, continuous, perfbot, verbose) = ParseArgs() |
| 712 PERFBOT_MODE = perfbot | 731 PERFBOT_MODE = perfbot |
| 713 VERBOSE = verbose | 732 VERBOSE = verbose |
| 714 if continuous: | 733 if continuous: |
| 715 while True: | 734 while True: |
| 716 if HasNewCode(): | 735 if HasNewCode(): |
| 717 RunTestSequence(cl, size, language, perf) | 736 RunTestSequence(cl, size, language, perf) |
| 718 else: | 737 else: |
| 719 time.sleep(SLEEP_TIME) | 738 time.sleep(SLEEP_TIME) |
| 720 else: | 739 else: |
| 721 RunTestSequence(cl, size, language, perf) | 740 RunTestSequence(cl, size, language, perf) |
| 722 | 741 |
| 723 if __name__ == '__main__': | 742 if __name__ == '__main__': |
| 724 main() | 743 main() |
| 725 | 744 |
| OLD | NEW |