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. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 results_log = tab.EvaluateJavaScript('__results') | 109 results_log = tab.EvaluateJavaScript('__results') |
110 all_scores = [] | 110 all_scores = [] |
111 for output in results_log: | 111 for output in results_log: |
112 # Split the results into score and test name. | 112 # Split the results into score and test name. |
113 # results log e.g., "Richards: 18343" | 113 # results log e.g., "Richards: 18343" |
114 score_and_name = output.split(': ', 2) | 114 score_and_name = output.split(': ', 2) |
115 assert len(score_and_name) == 2, \ | 115 assert len(score_and_name) == 2, \ |
116 'Unexpected result format "%s"' % score_and_name | 116 'Unexpected result format "%s"' % score_and_name |
117 if 'Skipped' not in score_and_name[1]: | 117 if 'Skipped' not in score_and_name[1]: |
118 name = score_and_name[0] | 118 name = score_and_name[0] |
119 score = int(score_and_name[1]) | 119 score = float(score_and_name[1]) |
120 results.AddValue(scalar.ScalarValue( | 120 results.AddValue(scalar.ScalarValue( |
121 results.current_page, name, 'score', score, important=False, | 121 results.current_page, name, 'score', score, important=False, |
122 description=DESCRIPTIONS.get(name))) | 122 description=DESCRIPTIONS.get(name))) |
123 | 123 |
124 # Collect all test scores to compute geometric mean. | 124 # Collect all test scores to compute geometric mean. |
125 all_scores.append(score) | 125 all_scores.append(score) |
126 total = statistics.GeometricMean(all_scores) | 126 total = statistics.GeometricMean(all_scores) |
127 results.AddSummaryValue( | 127 results.AddSummaryValue( |
128 scalar.ScalarValue(None, 'Total.Score', 'score', total, | 128 scalar.ScalarValue(None, 'Total.Score', 'score', total, |
129 description='Geometric mean of the scores of each ' | 129 description='Geometric mean of the scores of each ' |
(...skipping 14 matching lines...) Expand all Loading... |
144 | 144 |
145 def CreateStorySet(self, options): | 145 def CreateStorySet(self, options): |
146 ps = story.StorySet( | 146 ps = story.StorySet( |
147 archive_data_file='../page_sets/data/octane.json', | 147 archive_data_file='../page_sets/data/octane.json', |
148 base_dir=os.path.dirname(os.path.abspath(__file__)), | 148 base_dir=os.path.dirname(os.path.abspath(__file__)), |
149 cloud_storage_bucket=story.PUBLIC_BUCKET) | 149 cloud_storage_bucket=story.PUBLIC_BUCKET) |
150 ps.AddStory(page_module.Page( | 150 ps.AddStory(page_module.Page( |
151 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1', | 151 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1', |
152 ps, ps.base_dir, make_javascript_deterministic=False)) | 152 ps, ps.base_dir, make_javascript_deterministic=False)) |
153 return ps | 153 return ps |
OLD | NEW |