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

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

Issue 8670013: Adding the performance and browser benchmarking script. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « tools/testing/architecture.py ('k') | tools/testing/run_selenium.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/usr/bin/python
2
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
5 # BSD-style license that can be found in the LICENSE file.
6
7 import datetime
8 import math
9 from matplotlib.font_manager import FontProperties
10 import matplotlib.pyplot as plt
11 import os
12 import platform
13 import shutil
14 import subprocess
15 import time
16 import traceback
17
18 """This script runs to track performance and correctness progress of
19 different svn revisions. It tests to see if there a newer version of the code on
20 the server, and will sync and run the performance tests if so."""
21
22 DART_INSTALL_LOCATION = os.path.join(os.path.dirname(os.path.abspath(__file__)),
23 '..', '..', '..')
24 V8_MEAN = 'V8 Mean'
25 FROG_MEAN = 'frog Mean'
26 COMMAND_LINE = 'commandline'
27 V8 = 'v8'
28 FROG = 'frog'
29 V8_AND_FROG = [V8, FROG]
30 CORRECTNESS = 'Percent passing'
31 BENCHMARKS = ['Mandelbrot', 'DeltaBlue', 'Richards', 'NBody',
32 'BinaryTrees', 'Fannkuch', 'Meteor', 'BubbleSort', 'Fibonacci',
33 'Loop', 'Permute', 'Queens', 'QuickSort', 'Recurse', 'Sieve', 'Sum',
34 'Tak', 'Takl', 'Towers', 'TreeSort']
35 COLORS = ['blue', 'green', 'red', 'cyan', 'magenta', 'black']
36 GRAPH_OUT_DIR = 'graphs'
37
38 """First, some utility methods."""
39
40 def RunCmd(string):
41 """Run the specified command and print out any output to stdout.
42 Args:
43 string the command to run"""
44 p = subprocess.Popen(string, stdout = subprocess.PIPE,
45 stderr = subprocess.STDOUT, close_fds=True)
46 output, not_used = p.communicate();
47 print output:
48 return lines
49
50 def TimeCmd(self, cmd):
51 start = time.time()
52 RunCmd(cmd)
53 return time.time() - start
54
55 def SyncAndBuild(failed_once=False):
56 """Make sure we have the latest version of of the repo, and build it. We
57 begin and end standing in DART_INSTALL_LOCATION.
58 Args:
59 failed_once True if we have attempted to build this once before, and we've
60 failed, indicating ."""
61 os.chdir(DART_INSTALL_LOCATION)
62 #Revert our newly built frogsh to prevent conflicts when we update
63 RunCmd('svn revert ' + os.path.join(os.getcwd(), 'frog', 'frogsh'))
64
65 RunCmd('gclient sync')
66 lines = RunCmd('%s -m release' % os.path.join('.', 'tools', 'build.py'))
67 os.chdir('frog')
68 lines += RunCmd('%s -m debug,release' % os.path.join('..', 'tools',
69 'build.py'))
70 os.chdir('..')
71
72 for line in lines:
73 if '** BUILD FAILED **' in lines:
74 if TestRunner.failed_once:
75 # Someone checked in a broken build! Just stop trying to make it work
76 # and wait for the next hour to try again.
77 print 'Broken Build'
78 sys.exit(0)
79 #Remove the xcode directory and attempt to build again. If it still
80 #fails, abort, and try again next hour.
81 out_dir = 'out'
82 if platform.system() == 'Darwin':
83 out_dir = 'xcodebuild'
84 os.removedirs(os.getcwd() + os.path.join('dart', out_dir, 'Release_ia32'))
85 os.removedirs(os.getcwd() + os.path.join('dart', 'frog', out_dir,
86 'Release_ia32'))
87 os.removedirs(os.getcwd() + os.path.join('dart', 'frog', out_dir,
88 'Debug_ia32'))
89 TestRunner.failed_once = True
90 SyncAndBuild()
91
92 def EnsureOutputDirectory(dir_name):
93 """Test that the listed directory name exists, and if not, create one for
94 our output to be placed."""
95 dir_path = os.path.join(DART_INSTALL_LOCATION, 'tools', 'testing',
96 'perf_testing', dir_name)
97 if not os.path.exists(dir_path):
98 os.mkdir(dir_path)
99 print 'Creating output directory ', dir_path
100
101 def HasNewCode():
102 """Tests if there are any newer versions of files on the server."""
103 os.chdir(DART_INSTALL_LOCATION)
104 results = RunCmd('svn st -u')
105 for line in results:
106 if '*' in line:
107 return True
108 return False
109
110 def GetBrowsers():
111 browsers = ['ff', 'chrome']
112 if platform.system() == 'Windows':
113 browsers += ['ie']
114 return browsers
115
116 class TestRunner(object):
117 """The base clas to provide shared code for different tests we will run and
118 graph."""
119
120 def __init__(self, result_folder_name, platform_list, v8_and_or_frog_list,
121 values_list):
122 """Args:
123 result_folder_name the name of the folder where a tracefile of
124 performance results will be stored.
125 platform_list a list containing the platform(s) that our data has been
126 run on. (command line, firefox, chrome, etc)
127 v8_and_or_frog_list a list specifying whether we hold data about Frog
128 generated code, plain JS code (v8), or a combination of both.
129 values_list a list containing the type of data we will be graphing
130 (benchmarks, percentage passing, etc)"""
131 self.result_folder_name = result_folder_name
132 # cur_time is used as a timestamp of when this performance test was run.
133 self.cur_time = str(time.mktime(datetime.datetime.now().timetuple()))
134 self.browser_color = {'chrome': 'green', 'ie': 'blue', 'ff': 'red'}
135 self.values_list = values_list
136 self.platform_list = platform_list
137 self.revision_dict = dict()
138 self.values_dict = dict()
139 self.color_index = 0
140 for platform in platform_list:
141 self.revision_dict[platform] = dict()
142 self.values_dict[platform] = dict()
143 for f in v8_and_or_frog_list:
144 self.revision_dict[platform][f] = dict()
145 self.values_dict[platform][f] = dict()
146 for val in values_list:
147 self.revision_dict[platform][f][val] = []
148 self.values_dict[platform][f][val] = []
149 if V8 in v8_and_or_frog_list:
150 self.revision_dict[platform][V8][V8_MEAN] = []
151 self.values_dict[platform][V8][V8_MEAN] = []
152 if FROG in v8_and_or_frog_list:
153 self.revision_dict[platform][FROG][FROG_MEAN] = []
154 self.values_dict[platform][FROG][FROG_MEAN] = []
155
156 def GetColor(self):
157 color = COLORS[self.color_index]
158 self.color_index = (self.color_index + 1) % len(COLORS)
159 return color
160
161 def StyleAndSavePerfPlot(self, chart_title, y_axis_label, size_x, size_y,
162 legend_loc, filename, platform_list, v8_and_or_frog_list, values_list,
163 should_clear_axes=True):
164 """Sets style preferences for chart boilerplate that is consistent across
165 all charts, and saves the chart as a png.
166 Args:
167 size_x the size of the printed chart, in inches, in the horizontal
168 direction
169 size_y the size of the printed chart, in inches in the vertical direction
170 legend_loc the location of the legend in on the chart. See suitable
171 arguments for the loc argument in matplotlib
172 filename the filename that we want to save the resulting chart as
173 platform_list a list containing the platform(s) that our data has been run
174 on. (command line, firefox, chrome, etc)
175 values_list a list containing the type of data we will be graphing
176 (performance, percentage passing, etc)
177 should_clear_axes True if we want to create a fresh graph, instead of
178 plotting additional lines on the current graph."""
179 if should_clear_axes:
180 plt.cla() # cla = clear current axes
181 for platform in platform_list:
182 for f in v8_and_or_frog_list:
183 for val in values_list:
184 plt.plot(self.revision_dict[platform][f][val],
185 self.values_dict[platform][f][val],
186 color=self.GetColor(), label='%s-%s-%s' % (platform, f, val))
187
188 plt.xlabel('Revision Number')
189 plt.ylabel(y_axis_label)
190 plt.title(chart_title)
191 fontP = FontProperties()
192 fontP.set_size('small')
193 plt.legend(loc=legend_loc, prop = fontP)
194
195 fig = plt.gcf()
196 fig.set_size_inches(size_x, size_y)
197 fig.savefig(os.path.join(GRAPH_OUT_DIR, filename))
198
199 def AddSvnRevisionToTrace(self, outfile):
200 """Add the svn version number to the provided tracefile."""
201 p = subprocess.Popen('svn info ', stdout = subprocess.PIPE,
202 stderr = subprocess.STDOUT, close_fds=True)
203 output, not_used = p.communicate()
204 for line in output.split('\n'):
205 if 'Revision' in line:
206 RunCmd('echo "%s" > %s' % (line.strip(), outfile))
207
208 def WriteHtml(self, delimiter, rev_nums, label_1, dict_1, label_2, dict_2,
209 cleanFile=False):
210 """Adds an html table to the webpage to display the data values. This method
211 will be removed when we have a nicer way to display data values."""
212 #TODO(efortuna): fix this.
213 return
214 #TODO(efortuna): Take this method out when have finalized where the data is
215 # going to be displayed.
216 f = ''
217 out = ''
218 if cleanFile:
219 f = open('template.html')
220 else:
221 shutil.copy('index.html', 'temp.html')
222 f = open('temp.html')
223 out = open('index.html', 'w')
224 inTable = False
225 for line in f.readlines():
226 if not inTable:
227 out.write(line)
228 if delimiter in line:
229 inTable = not inTable
230 if inTable:
231 out.write('<table border="1"> <tr> <td> svn revision </td>')
232 for revision in rev_nums:
233 out.write('<td>%d</td>' % revision)
234 out.write('</tr>\n<tr><td> %s</td>' % label_1)
235 for perf in dict_1:
236 out.write('<td>%f</td>' % perf)
237 out.write('</tr>\n<tr><td> %s</td>' % label_2)
238 for perf in dict_2:
239 out.write('<td>%f</td>' % perf)
240 out.write('</tr> </table>')
241
242 def CalculateGeometricMean(self, platform, frog_or_v8, svn_revision):
243 """Calculate the aggregate geometric mean for V8 and frog benchmark sets,
244 given two benchmark dictionaries."""
245 geo_mean = 0
246 for benchmark in BENCHMARKS:
247 geo_mean += math.log(self.values_dict[platform][frog_or_v8][benchmark][
248 len(self.values_dict[platform][frog_or_v8][benchmark]) - 1])
249
250 mean = V8_MEAN
251 if frog_or_v8 == FROG:
252 mean = FROG_MEAN
253 self.values_dict[platform][frog_or_v8][mean] += \
254 [math.pow(math.e, geo_mean / len(BENCHMARKS))]
255 self.revision_dict[platform][frog_or_v8][mean] += [svn_revision]
256
257 def Run(self):
258 """Run the benchmarks/tests from the command line and plot the
259 results."""
260 plt.cla() # cla = clear current axes
261 os.chdir(DART_INSTALL_LOCATION)
262 EnsureOutputDirectory(self.result_folder_name)
263 EnsureOutputDirectory(GRAPH_OUT_DIR)
264 self.RunTests()
265 os.chdir(os.path.join('tools', 'testing', 'perf_testing'))
266
267 # TODO(efortuna): You will want to make this only use a subset of the files
268 # eventually.
269 files = os.listdir(self.result_folder_name)
270
271 for afile in files:
272 if not afile.startswith('.'):
273 self.ProcessFile(afile)
274 self.PlotResults('%s.png' % self.result_folder_name)
275
276 class PerformanceTestRunner(TestRunner):
277 """Super class for all performance testing."""
278 def __init__(self, result_folder_name, platform_list, platform_type):
279 super(PerformanceTestRunner, self).__init__(result_folder_name,
280 platform_list, V8_AND_FROG, BENCHMARKS)
281 self.platform_list = platform_list
282 self.platform_type = platform_type
283
284 def PlotAllPerf(self, png_filename):
285 """Create a plot that shows the performance changes of individual benchmarks
286 run by V8 and generated by frog, over svn history."""
287 for benchmark in BENCHMARKS:
288 self.StyleAndSavePerfPlot(
289 'Performance of %s over time on the %s' % (benchmark,
290 self.platform_type), 'Speed (bigger = better)', 16, 14, 'lower left',
291 benchmark + png_filename, self.platform_list, V8_AND_FROG,
292 [benchmark])
293
294 def PlotAvgPerf(self, png_filename):
295 """Generate a plot that shows the performance changes of the geomentric mean
296 of V8 and frog benchmark performance over svn history."""
297 (title, y_axis, size_x, size_y, loc, filename) = \
298 ('Geometric Mean of benchmark %s performance' % self.platform_type,
299 'Speed (bigger = better)', 16, 5, 'center', 'avg'+png_filename)
300 for platform in self.platform_list:
301 self.StyleAndSavePerfPlot(title, y_axis, size_x, size_y, loc, filename,
302 [platform], [V8], [V8_MEAN], True)
303 self.StyleAndSavePerfPlot(title, y_axis, size_x, size_y, loc, filename,
304 [platform], [FROG], [FROG_MEAN], False)
305 self.WriteHtml('table',
306 self.revision_dict[platform][V8],
307 'V8 mean', self.values_dict[platform][V8][V8_MEAN],
308 'Frog mean', self.values_dict[platform][FROG][FROG_MEAN],
309 True)
310
311 def PlotResults(self, png_filename):
312 self.PlotAllPerf(png_filename)
313 self.PlotAvgPerf('2' + png_filename)
314
315 class CommandLinePerformanceTestRunner(PerformanceTestRunner):
316 """Run performance tests from the command line."""
317
318 def __init__(self, result_folder_name):
319 super(CommandLinePerformanceTestRunner, self).__init__(result_folder_name,
320 [COMMAND_LINE], 'command line')
321
322 def ProcessFile(self, afile):
323 """Pull all the relevant information out of a given tracefile.
324
325 Args:
326 afile is the filename string we will be processing."""
327 f = open(os.path.join(self.result_folder_name, afile))
328 tabulate_data = False
329 revision_num = 0
330 for line in f.readlines():
331 if 'Revision' in line:
332 revision_num = int(line.split()[1])
333 elif 'Benchmark' in line:
334 tabulate_data = True
335 elif tabulate_data:
336 tokens = line.split()
337 if len(tokens) < 4 or tokens[0] not in BENCHMARKS:
338 #Done tabulating data.
339 break
340 v8_value = float(tokens[1])
341 frog_value = float(tokens[3])
342 if v8_value == 0 or frog_value == 0:
343 #Then there was an error when this performance test was run. Do not
344 #count it in our numbers.
345 return
346 benchmark = tokens[0]
347 self.revision_dict[COMMAND_LINE][V8][benchmark] += [revision_num]
348 self.values_dict[COMMAND_LINE][V8][benchmark] += [v8_value]
349 self.revision_dict[COMMAND_LINE][FROG][benchmark] += [revision_num]
350 self.values_dict[COMMAND_LINE][FROG][benchmark] += [frog_value]
351 f.close()
352
353 self.CalculateGeometricMean(COMMAND_LINE, FROG, revision_num)
354 self.CalculateGeometricMean(COMMAND_LINE, V8, revision_num)
355
356 def RunTests(self):
357 """Run a performance test on our updated system."""
358 os.chdir('frog')
359 file_path = os.path.join('..', 'tools', 'testing', 'perf_testing',
360 self.result_folder_name, 'result')
361 RunCmd('python %s > %s%s' % (os.path.join('benchmarks',
362 'perf_tests.py'), file_path, self.cur_time))
363 os.chdir('..')
364
365
366 class BrowserPerformanceTestRunner(PerformanceTestRunner):
367 """Runs performance tests, in the browser."""
368
369 def __init__(self, result_folder_name):
370 super(BrowserPerformanceTestRunner, self).__init__(
371 result_folder_name, GetBrowsers(), 'browser')
372
373 def RunTests(self):
374 """Run a performance test in the browser."""
375 os.chdir('frog')
376 RunCmd('python benchmarks/make_web_benchmarks.py')
377 os.chdir('..')
378
379 for browser in GetBrowsers():
380 for version in V8_AND_FROG:
381 self.AddSvnRevisionToTrace(os.path.join('tools', 'testing',
382 'perf_testing', self.result_folder_name,
383 'perf-%s-%s-%s' % (self.cur_time, browser, version)))
384 RunCmd('python %s --out %s --browser %s --timeout 1000 --perf >> %s' %
385 (os.path.join('tools', 'testing', 'run_selenium.py'),
386 os.path.join(os.getcwd(), 'internal', 'browserBenchmarks',
387 'benchmark_page_%s.html' % version),
388 browser,
389 os.path.join('tools', 'testing', 'perf_testing',
390 self.result_folder_name, 'perf-%s-%s-%s' % (self.cur_time, browser,
391 version))))
392
393 def ProcessFile(self, afile):
394 """Comb through the html to find the performance results."""
395 parts = afile.split('-')
396 browser = parts[2]
397 version = parts[3]
398 f = open(os.path.join(self.result_folder_name, afile))
399 lines = f.readlines()
400 line = ''
401 i = 0
402 revision_num = 0
403 while '<div id="results">' not in line and i < len(lines):
404 if 'Revision' in line:
405 revision_num = int(line.split()[1])
406 line = lines[i]
407 i += 1
408
409 if i >= len(lines) or revision_num == 0:
410 # Then this run did not complete. Ignore this tracefile.
411 return
412
413 line = lines[i]
414 i += 1
415 results = []
416 if line.find('<br>') > -1:
417 results = line.split('<br>')
418 else:
419 results = line.split('<br />')
420 for result in results:
421 name_and_score = result.split(':')
422 if len(name_and_score) < 2:
423 break
424 name = name_and_score[0].strip()
425 score = name_and_score[1].strip()
426 if version == V8:
427 bench_dict = self.values_dict[browser][V8]
428 else:
429 bench_dict = self.values_dict[browser][FROG]
430 bench_dict[name] += [float(score)]
431 self.revision_dict[browser][version][name] += [revision_num]
432
433 f.close()
434 self.CalculateGeometricMean(browser, version, revision_num)
435
436 def WriteHtml(self, delimiter, rev_nums, label_1, dict_1, label_2, dict_2,
437 cleanFile=False):
438 #TODO(efortuna)
439 pass
440
441 class BrowserCorrectnessTestRunner(TestRunner):
442 def __init__(self, test_type, result_folder_name):
443 super(BrowserCorrectnessTestRunner, self).__init__(result_folder_name,
444 GetBrowsers(), [FROG], [CORRECTNESS])
445 self.test_type = test_type
446
447 def RunTests(self):
448 """Run a test of the latest svn revision."""
449 for browser in GetBrowsers():
450 current_file = 'correctness%s-%s' % (self.cur_time, browser)
451 current_file_path = os.path.join('tools', 'testing',
452 'perf_testing', self.result_folder_name, current_file)
453 self.AddSvnRevisionToTrace(current_file_path)
454 RunCmd(os.path.join('.', 'tools', 'test.py') +
455 ' --component=webdriver --flag=%s --report --timeout=20 ' % browser +
456 '--progress=color --mode=release -j1 %s >>' % self.test_type +
457 current_file_path)
458
459 def ProcessFile(self, afile):
460 """Given a trace file, extract all the relevant information out of it to
461 determine the number of correctly passing tests.
462
463 Arguments:
464 afile the filename string"""
465 browser = afile.rpartition('-')[2]
466 f = open(os.path.join(self.result_folder_name, afile))
467 revision_num = 0
468 lines = f.readlines()
469 total_tests = 0
470 num_failed = 0
471 expect_fail = 0
472 for line in lines:
473 if 'Total:' in line:
474 total_tests = int(line.split()[1])
475 if 'will be skipped' in line:
476 total_tests -= int(line.split()[1])
477 if 'we should fix' in line:
478 expect_fail += int(line.split()[1])
479 if 'Revision' in line:
480 revision_num = int(line.split()[1])
481 if '--- TIMEOUT ---' in line or 'FAIL:' in line or 'PASS' in line:
482 # (A printed out 'PASS' indicates we incorrectly passed a negative
483 # test.)
484 num_failed += 1
485
486 self.revision_dict[browser][FROG][CORRECTNESS] += [revision_num]
487 self.values_dict[browser][FROG][CORRECTNESS] += [100.0 *
488 (((float)(total_tests - (expect_fail + num_failed))) /total_tests)]
489 f.close()
490
491 def PlotResults(self, png_filename):
492 first_time = True
493 for browser in GetBrowsers():
494 self.StyleAndSavePerfPlot('Percentage of language tests passing in '
495 'different browsers', '% of tests passed', 8, 8, 'lower left',
496 png_filename, [browser], [FROG], [CORRECTNESS], first_time)
497 first_time = False
498
499
500 class CompileTimeAndSizeTestRunner(TestRunner):
501 """Run tests to determine how long frogsh takes to compile, and the compiled
502 file output size of some benchmarking files."""
503 def __init__(self, result_folder_name):
504 super(CompileTimeAndSizeTestRunner, self).__init__(result_folder_name,
505 [COMMAND_LINE], [FROG], ['Compiling on Dart VM', 'Bootstrapping',
506 'frogsh', 'swarm', 'total'])
507 self.failure_threshold = {'Compiling on Dart VM' : 1, 'Bootstrapping' : .5,
508 'frogsh' : 100, 'swarm' : 100, 'total' : 100}
509
510 def RunTests(self):
511 os.chdir('frog')
512 current_file_path = os.path.join('..', 'tools', 'testing', 'perf_testing',
513 self.result_folder_name, self.result_folder_name + self.cur_time)
514
515 self.AddSvnRevisionToTrace(current_file_path)
516
517 elapsed = TimeCmd(os.path.join('.', 'frog.py') +
518 ' --vm_flags="--compile_all --enable_type_checks --enable_asserts" --'
519 ' --compile_all --enable_type_checks --out=frogsh frog.dart')
520 RunCmd('echo "%f Compiling on Dart VM in checked mode in' % elapsed +
521 ' seconds" >> %s' % current_file_path)
522 RunCmd('chmod +x frogsh')
523 elapsed = TimeCmd(os.path.join('.', 'frogsh') + ' --out=frogsh '
524 '--enable_type_checks frog.dart --enable_type_checks ' +
525 os.path.join('tests', 'hello.dart'))
526 if elapsed < self.failure_threshold['Bootstrapping']:
527 #frogsh didn't compile correctly. Stop testing now, because subsequent
528 #numbers will be meaningless.
529 return
530 size = os.path.getsize('frogsh')
531 RunCmd('echo "%f Bootstrapping time in seconds in checked mode"' %
532 elapsed + ' >> %s' % current_file_path)
533 RunCmd('echo "%d Generated checked frogsh size "' % size +
534 ' >> %s' % current_file_path)
535
536 RunCmd(os.path.join('.', 'frogsh') + ' --out=swarm-result '
537 '--compile-only ' + os.path.join('..', 'client', 'samples', 'swarm',
538 'swarm.dart'))
539 swarm_size = 0
540 try:
541 swarm_size = os.path.getsize('swarm-result')
542 except OSError:
543 pass #If compilation failed, continue on running other tests.
544
545 RunCmd(os.path.join('.', 'frogsh') + ' --out=total-result '
546 '--compile-only ' + os.path.join('..', 'client', 'samples', 'total',
547 'src', 'Total.dart'))
548 total_size = 0
549 try:
550 total_size = os.path.getsize('total-result')
551 except OSError:
552 pass #If compilation failed, continue on running other tests.
553
554 RunCmd('echo "%d Generated checked swarm size "' % swarm_size +
555 ' >> %s' % current_file_path)
556
557 RunCmd('echo "%d Generated checked total size "' % total_size +
558 ' >> %s' % current_file_path)
559 os.chdir('..')
560
561 def ProcessFile(self, afile):
562 """Pull all the relevant information out of a given tracefile.
563 Args:
564 afile is the filename string we will be processing."""
565 f = open(os.path.join(self.result_folder_name, afile))
566 tabulate_data = False
567 revision_num = 0
568 for line in f.readlines():
569 tokens = line.split()
570 if 'Revision' in line:
571 revision_num = int(line.split()[1])
572 else:
573 for metric in self.values_list:
574 if metric in line:
575 num = tokens[0]
576 if num.find('.') == -1:
577 num = int(num)
578 else:
579 num = float(num)
580 self.values_dict[COMMAND_LINE][FROG][metric] += [num]
581 self.revision_dict[COMMAND_LINE][FROG][metric] += [revision_num]
582
583 if revision_num != 0:
584 for metric in self.values_list:
585 self.revision_dict[COMMAND_LINE][FROG][metric].pop()
586 self.revision_dict[COMMAND_LINE][FROG][metric] += [revision_num]
587 # Fill 0 if compilation failed.
588 if self.values_dict[COMMAND_LINE][FROG][metric][-1] < \
589 self.failure_threshold[metric]:
590 self.values_dict[COMMAND_LINE][FROG][metric] += [0]
591 self.revision_dict[COMMAND_LINE][FROG][metric] += [revision_num]
592
593 f.close()
594
595 def PlotResults(self, png_filename):
596 self.StyleAndSavePerfPlot('Compiled frogsh Sizes',
597 'Size (in bytes)', 10, 10, 'center', png_filename, [COMMAND_LINE],
598 [FROG], ['swarm', 'total', 'frogsh'])
599 self.WriteHtml('bar', self.revision_dict[COMMAND_LINE][FROG]['frogsh'],
600 'frogsh size', self.values_dict[COMMAND_LINE][FROG]['frogsh'], '', [])
601
602 self.StyleAndSavePerfPlot('Time to compile and bootstrap',
603 'Seconds', 10, 10, 'center', '2' + png_filename, [COMMAND_LINE], [FROG],
604 ['Bootstrapping', 'Compiling on Dart VM'])
605 self.WriteHtml('baz',
606 self.revision_dict[COMMAND_LINE][FROG]['Bootstrapping'],
607 'Bootstrapping', self.values_dict[COMMAND_LINE][FROG]['Bootstrapping'],
608 'Compiling on Dart VM',
609 self.values_dict[COMMAND_LINE][FROG]['Compiling on Dart VM'])
610
611
612 def main():
613 if HasNewCode():
614 SyncAndBuild()
615 CommandLinePerformanceTestRunner('cl-results').Run()
616 CompileTimeAndSizeTestRunner('code-time-size').Run()
617 BrowserCorrectnessTestRunner('language', 'browser-correctness').Run()
618 BrowserPerformanceTestRunner('browser-perf').Run()
619
620 if __name__ == '__main__':
621 main()
622
OLDNEW
« no previous file with comments | « tools/testing/architecture.py ('k') | tools/testing/run_selenium.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698