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

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