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 import page as page_module | 18 from telemetry import page as page_module |
19 from telemetry.page import page_set | 19 from telemetry.page import page_set |
20 from telemetry.page import page_test | 20 from telemetry.page import page_test |
21 from telemetry.util import statistics | 21 from telemetry.util import statistics |
| 22 from telemetry.value import improvement_direction |
22 from telemetry.value import scalar | 23 from telemetry.value import scalar |
23 | 24 |
24 _GB = 1024 * 1024 * 1024 | 25 _GB = 1024 * 1024 * 1024 |
25 | 26 |
26 DESCRIPTIONS = { | 27 DESCRIPTIONS = { |
27 'CodeLoad': | 28 'CodeLoad': |
28 'Measures how quickly a JavaScript engine can start executing code ' | 29 'Measures how quickly a JavaScript engine can start executing code ' |
29 'after loading a large JavaScript program, social widget being a common ' | 30 'after loading a large JavaScript program, social widget being a common ' |
30 'example. The source for test is derived from open source libraries ' | 31 'example. The source for test is derived from open source libraries ' |
31 '(Closure, jQuery) (1,530 lines).', | 32 '(Closure, jQuery) (1,530 lines).', |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 # Split the results into score and test name. | 112 # Split the results into score and test name. |
112 # results log e.g., "Richards: 18343" | 113 # results log e.g., "Richards: 18343" |
113 score_and_name = output.split(': ', 2) | 114 score_and_name = output.split(': ', 2) |
114 assert len(score_and_name) == 2, \ | 115 assert len(score_and_name) == 2, \ |
115 'Unexpected result format "%s"' % score_and_name | 116 'Unexpected result format "%s"' % score_and_name |
116 if 'Skipped' not in score_and_name[1]: | 117 if 'Skipped' not in score_and_name[1]: |
117 name = score_and_name[0] | 118 name = score_and_name[0] |
118 score = int(score_and_name[1]) | 119 score = int(score_and_name[1]) |
119 results.AddValue(scalar.ScalarValue( | 120 results.AddValue(scalar.ScalarValue( |
120 results.current_page, name, 'score', score, important=False, | 121 results.current_page, name, 'score', score, important=False, |
121 description=DESCRIPTIONS.get(name))) | 122 description=DESCRIPTIONS.get(name), |
| 123 improvement_direction=improvement_direction.UP)) |
122 | 124 |
123 # Collect all test scores to compute geometric mean. | 125 # Collect all test scores to compute geometric mean. |
124 all_scores.append(score) | 126 all_scores.append(score) |
125 total = statistics.GeometricMean(all_scores) | 127 total = statistics.GeometricMean(all_scores) |
126 results.AddSummaryValue( | 128 results.AddSummaryValue( |
127 scalar.ScalarValue(None, 'Total.Score', 'score', total, | 129 scalar.ScalarValue(None, 'Total.Score', 'score', total, |
128 description='Geometric mean of the scores of each ' | 130 description='Geometric mean of the scores of each ' |
129 'individual benchmark in the Octane ' | 131 'individual benchmark in the Octane ' |
130 'benchmark collection.')) | 132 'benchmark collection.', |
| 133 improvement_direction=improvement_direction.UP)) |
131 | 134 |
132 | 135 |
133 class Octane(benchmark.Benchmark): | 136 class Octane(benchmark.Benchmark): |
134 """Google's Octane JavaScript benchmark. | 137 """Google's Octane JavaScript benchmark. |
135 | 138 |
136 http://octane-benchmark.googlecode.com/svn/latest/index.html | 139 http://octane-benchmark.googlecode.com/svn/latest/index.html |
137 """ | 140 """ |
138 test = _OctaneMeasurement | 141 test = _OctaneMeasurement |
139 | 142 |
140 def CreatePageSet(self, options): | 143 def CreatePageSet(self, options): |
141 ps = page_set.PageSet( | 144 ps = page_set.PageSet( |
142 archive_data_file='../page_sets/data/octane.json', | 145 archive_data_file='../page_sets/data/octane.json', |
143 file_path=os.path.abspath(__file__), | 146 file_path=os.path.abspath(__file__), |
144 bucket=page_set.PUBLIC_BUCKET) | 147 bucket=page_set.PUBLIC_BUCKET) |
145 ps.AddUserStory(page_module.Page( | 148 ps.AddUserStory(page_module.Page( |
146 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1', | 149 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1', |
147 ps, ps.base_dir, make_javascript_deterministic=False)) | 150 ps, ps.base_dir, make_javascript_deterministic=False)) |
148 return ps | 151 return ps |
OLD | NEW |