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 |
23 _GB = 1024 * 1024 * 1024 | 24 _GB = 1024 * 1024 * 1024 |
24 | 25 |
| 26 |
25 class _OctaneMeasurement(page_measurement.PageMeasurement): | 27 class _OctaneMeasurement(page_measurement.PageMeasurement): |
26 def __init__(self): | 28 def __init__(self): |
27 super(_OctaneMeasurement, self).__init__() | 29 super(_OctaneMeasurement, self).__init__() |
28 self._power_metric = None | 30 self._power_metric = None |
29 | 31 |
30 def CustomizeBrowserOptions(self, options): | 32 def CustomizeBrowserOptions(self, options): |
31 power.PowerMetric.CustomizeBrowserOptions(options) | 33 power.PowerMetric.CustomizeBrowserOptions(options) |
32 | 34 |
33 def WillStartBrowser(self, browser): | 35 def WillStartBrowser(self, browser): |
34 self._power_metric = power.PowerMetric(browser) | 36 self._power_metric = power.PowerMetric(browser) |
(...skipping 27 matching lines...) Expand all Loading... |
62 all_scores = [] | 64 all_scores = [] |
63 for output in results_log: | 65 for output in results_log: |
64 # Split the results into score and test name. | 66 # Split the results into score and test name. |
65 # results log e.g., "Richards: 18343" | 67 # results log e.g., "Richards: 18343" |
66 score_and_name = output.split(': ', 2) | 68 score_and_name = output.split(': ', 2) |
67 assert len(score_and_name) == 2, \ | 69 assert len(score_and_name) == 2, \ |
68 'Unexpected result format "%s"' % score_and_name | 70 'Unexpected result format "%s"' % score_and_name |
69 if 'Skipped' not in score_and_name[1]: | 71 if 'Skipped' not in score_and_name[1]: |
70 name = score_and_name[0] | 72 name = score_and_name[0] |
71 score = int(score_and_name[1]) | 73 score = int(score_and_name[1]) |
72 results.Add(name, 'score', score, data_type='unimportant') | 74 results.AddValue(scalar.ScalarValue( |
| 75 results.current_page, name, 'score', score, important=False)) |
| 76 |
73 # Collect all test scores to compute geometric mean. | 77 # Collect all test scores to compute geometric mean. |
74 all_scores.append(score) | 78 all_scores.append(score) |
75 total = statistics.GeometricMean(all_scores) | 79 total = statistics.GeometricMean(all_scores) |
76 results.AddSummaryValue( | 80 results.AddSummaryValue( |
77 scalar.ScalarValue(None, 'Total.Score', 'score', total)) | 81 scalar.ScalarValue(None, 'Total.Score', 'score', total)) |
78 | 82 |
79 | 83 |
80 class Octane(benchmark.Benchmark): | 84 class Octane(benchmark.Benchmark): |
81 """Google's Octane JavaScript benchmark.""" | 85 """Google's Octane JavaScript benchmark.""" |
82 test = _OctaneMeasurement | 86 test = _OctaneMeasurement |
83 | 87 |
84 def CreatePageSet(self, options): | 88 def CreatePageSet(self, options): |
85 ps = page_set.PageSet( | 89 ps = page_set.PageSet( |
86 archive_data_file='../page_sets/data/octane.json', | 90 archive_data_file='../page_sets/data/octane.json', |
87 make_javascript_deterministic=False, | 91 make_javascript_deterministic=False, |
88 file_path=os.path.abspath(__file__)) | 92 file_path=os.path.abspath(__file__)) |
89 ps.AddPageWithDefaultRunNavigate( | 93 ps.AddPageWithDefaultRunNavigate( |
90 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') | 94 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') |
91 return ps | 95 return ps |
OLD | NEW |