OLD | NEW |
1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Runs Octane 2.0 javascript benchmark. | 5 """Runs Octane 2.0 javascript benchmark. |
6 | 6 |
7 Octane 2.0 is a modern benchmark that measures a JavaScript engine's performance | 7 Octane 2.0 is a modern benchmark that measures a JavaScript engine's performance |
8 by running a suite of tests representative of today's complex and demanding web | 8 by running a suite of tests representative of today's complex and demanding web |
9 applications. Octane's goal is to measure the performance of JavaScript code | 9 applications. Octane's goal is to measure the performance of JavaScript code |
10 found in large, real-world web applications. | 10 found in large, real-world web applications. |
11 Octane 2.0 consists of 17 tests, four more than Octane v1. | 11 Octane 2.0 consists of 17 tests, four more than Octane v1. |
12 """ | 12 """ |
13 | 13 |
14 import os | 14 import os |
15 | 15 |
16 from metrics import power | 16 from metrics import power |
17 from telemetry import benchmark | 17 from telemetry import benchmark |
18 from telemetry.page import page_measurement | 18 from telemetry.page import page_measurement |
19 from telemetry.page import page_set | 19 from telemetry.page import page_set |
20 from telemetry.util import statistics | 20 from telemetry.util import statistics |
21 from telemetry.value import scalar | 21 from telemetry.value import scalar |
22 | 22 |
| 23 _GB = 1024 * 1024 * 1024 |
23 | 24 |
24 _GB = 1024 * 1024 * 1024 | 25 DESCRIPTIONS = { |
| 26 'CodeLoad': |
| 27 'Measures how quickly a JavaScript engine can start executing code ' |
| 28 'after loading a large JavaScript program, social widget being a common ' |
| 29 'example. The source for test is derived from open source libraries ' |
| 30 '(Closure, jQuery) (1,530 lines).', |
| 31 'Crypto': |
| 32 'Encryption and decryption benchmark based on code by Tom Wu ' |
| 33 '(1698 lines).', |
| 34 'DeltaBlue': |
| 35 'One-way constraint solver, originally written in Smalltalk by John ' |
| 36 'Maloney and Mario Wolczko (880 lines).', |
| 37 'EarleyBoyer': |
| 38 'Classic Scheme benchmarks, translated to JavaScript by Florian ' |
| 39 'Loitsch\'s Scheme2Js compiler (4684 lines).', |
| 40 'Gameboy': |
| 41 'Emulate the portable console\'s architecture and runs a demanding 3D ' |
| 42 'simulation, all in JavaScript (11,097 lines).', |
| 43 'Mandreel': |
| 44 'Runs the 3D Bullet Physics Engine ported from C++ to JavaScript via ' |
| 45 'Mandreel (277,377 lines).', |
| 46 'NavierStokes': |
| 47 '2D NavierStokes equations solver, heavily manipulates double precision ' |
| 48 'arrays. Based on Oliver Hunt\'s code (387 lines).', |
| 49 'PdfJS': |
| 50 'Mozilla\'s PDF Reader implemented in JavaScript. It measures decoding ' |
| 51 'and interpretation time (33,056 lines).', |
| 52 'RayTrace': |
| 53 'Ray tracer benchmark based on code by Adam Burmister (904 lines).', |
| 54 'RegExp': |
| 55 'Regular expression benchmark generated by extracting regular ' |
| 56 'expression operations from 50 of the most popular web pages ' |
| 57 '(1761 lines).', |
| 58 'Richards': |
| 59 'OS kernel simulation benchmark, originally written in BCPL by Martin ' |
| 60 'Richards (539 lines).', |
| 61 'Splay': |
| 62 'Data manipulation benchmark that deals with splay trees and exercises ' |
| 63 'the automatic memory management subsystem (394 lines).', |
| 64 } |
25 | 65 |
26 | 66 |
27 class _OctaneMeasurement(page_measurement.PageMeasurement): | 67 class _OctaneMeasurement(page_measurement.PageMeasurement): |
28 def __init__(self): | 68 def __init__(self): |
29 super(_OctaneMeasurement, self).__init__() | 69 super(_OctaneMeasurement, self).__init__() |
30 self._power_metric = None | 70 self._power_metric = None |
31 | 71 |
32 def CustomizeBrowserOptions(self, options): | 72 def CustomizeBrowserOptions(self, options): |
33 power.PowerMetric.CustomizeBrowserOptions(options) | 73 power.PowerMetric.CustomizeBrowserOptions(options) |
34 | 74 |
(...skipping 30 matching lines...) Expand all Loading... |
65 for output in results_log: | 105 for output in results_log: |
66 # Split the results into score and test name. | 106 # Split the results into score and test name. |
67 # results log e.g., "Richards: 18343" | 107 # results log e.g., "Richards: 18343" |
68 score_and_name = output.split(': ', 2) | 108 score_and_name = output.split(': ', 2) |
69 assert len(score_and_name) == 2, \ | 109 assert len(score_and_name) == 2, \ |
70 'Unexpected result format "%s"' % score_and_name | 110 'Unexpected result format "%s"' % score_and_name |
71 if 'Skipped' not in score_and_name[1]: | 111 if 'Skipped' not in score_and_name[1]: |
72 name = score_and_name[0] | 112 name = score_and_name[0] |
73 score = int(score_and_name[1]) | 113 score = int(score_and_name[1]) |
74 results.AddValue(scalar.ScalarValue( | 114 results.AddValue(scalar.ScalarValue( |
75 results.current_page, name, 'score', score, important=False)) | 115 results.current_page, name, 'score', score, important=False, |
| 116 description=DESCRIPTIONS.get(name))) |
76 | 117 |
77 # Collect all test scores to compute geometric mean. | 118 # Collect all test scores to compute geometric mean. |
78 all_scores.append(score) | 119 all_scores.append(score) |
79 total = statistics.GeometricMean(all_scores) | 120 total = statistics.GeometricMean(all_scores) |
80 results.AddSummaryValue( | 121 results.AddSummaryValue( |
81 scalar.ScalarValue(None, 'Total.Score', 'score', total)) | 122 scalar.ScalarValue(None, 'Total.Score', 'score', total, |
| 123 description='Geometric mean of the scores of each ' |
| 124 'individual benchmark in the Octane ' |
| 125 'benchmark collection.')) |
82 | 126 |
83 | 127 |
84 class Octane(benchmark.Benchmark): | 128 class Octane(benchmark.Benchmark): |
85 """Google's Octane JavaScript benchmark.""" | 129 """Google's Octane JavaScript benchmark.""" |
86 test = _OctaneMeasurement | 130 test = _OctaneMeasurement |
87 | 131 |
88 def CreatePageSet(self, options): | 132 def CreatePageSet(self, options): |
89 ps = page_set.PageSet( | 133 ps = page_set.PageSet( |
90 archive_data_file='../page_sets/data/octane.json', | 134 archive_data_file='../page_sets/data/octane.json', |
91 make_javascript_deterministic=False, | 135 make_javascript_deterministic=False, |
92 file_path=os.path.abspath(__file__)) | 136 file_path=os.path.abspath(__file__)) |
93 ps.AddPageWithDefaultRunNavigate( | 137 ps.AddPageWithDefaultRunNavigate( |
94 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') | 138 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') |
95 return ps | 139 return ps |
OLD | NEW |