| 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 measurements import PageTestMeasurement |
| 16 from metrics import power | 17 from metrics import power |
| 17 from telemetry import benchmark | 18 from telemetry import benchmark |
| 18 from telemetry.page import page_set | 19 from telemetry.page import page_set |
| 19 from telemetry.page import page_test | |
| 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 _GB = 1024 * 1024 * 1024 |
| 24 | 24 |
| 25 DESCRIPTIONS = { | 25 DESCRIPTIONS = { |
| 26 'CodeLoad': | 26 'CodeLoad': |
| 27 'Measures how quickly a JavaScript engine can start executing code ' | 27 'Measures how quickly a JavaScript engine can start executing code ' |
| 28 'after loading a large JavaScript program, social widget being a common ' | 28 'after loading a large JavaScript program, social widget being a common ' |
| 29 'example. The source for test is derived from open source libraries ' | 29 'example. The source for test is derived from open source libraries ' |
| (...skipping 27 matching lines...) Expand all Loading... |
| 57 '(1761 lines).', | 57 '(1761 lines).', |
| 58 'Richards': | 58 'Richards': |
| 59 'OS kernel simulation benchmark, originally written in BCPL by Martin ' | 59 'OS kernel simulation benchmark, originally written in BCPL by Martin ' |
| 60 'Richards (539 lines).', | 60 'Richards (539 lines).', |
| 61 'Splay': | 61 'Splay': |
| 62 'Data manipulation benchmark that deals with splay trees and exercises ' | 62 'Data manipulation benchmark that deals with splay trees and exercises ' |
| 63 'the automatic memory management subsystem (394 lines).', | 63 'the automatic memory management subsystem (394 lines).', |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 class _OctaneMeasurement(page_test.PageTest): | 67 class _OctaneMeasurement(PageTestMeasurement): |
| 68 def __init__(self): | 68 def __init__(self): |
| 69 super(_OctaneMeasurement, self).__init__() | 69 super(_OctaneMeasurement, self).__init__() |
| 70 self._power_metric = None | 70 self._power_metric = None |
| 71 | 71 |
| 72 def CustomizeBrowserOptions(self, options): | 72 def CustomizeBrowserOptions(self, options): |
| 73 super(_OctaneMeasurement, self).CustomizeBrowserOptions(options) |
| 73 power.PowerMetric.CustomizeBrowserOptions(options) | 74 power.PowerMetric.CustomizeBrowserOptions(options) |
| 74 | 75 |
| 75 def WillStartBrowser(self, platform): | 76 def WillStartBrowser(self, platform): |
| 76 self._power_metric = power.PowerMetric(platform) | 77 self._power_metric = power.PowerMetric(platform) |
| 77 | 78 |
| 78 def WillNavigateToPage(self, page, tab): | 79 def WillNavigateToPage(self, page, tab): |
| 79 memory_stats = tab.browser.memory_stats | 80 memory_stats = tab.browser.memory_stats |
| 80 if ('SystemTotalPhysicalMemory' in memory_stats and | 81 if ('SystemTotalPhysicalMemory' in memory_stats and |
| 81 memory_stats['SystemTotalPhysicalMemory'] < 1 * _GB): | 82 memory_stats['SystemTotalPhysicalMemory'] < 1 * _GB): |
| 82 skipBenchmarks = '"zlib"' | 83 skipBenchmarks = '"zlib"' |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 description=DESCRIPTIONS.get(name))) | 119 description=DESCRIPTIONS.get(name))) |
| 119 | 120 |
| 120 # Collect all test scores to compute geometric mean. | 121 # Collect all test scores to compute geometric mean. |
| 121 all_scores.append(score) | 122 all_scores.append(score) |
| 122 total = statistics.GeometricMean(all_scores) | 123 total = statistics.GeometricMean(all_scores) |
| 123 results.AddSummaryValue( | 124 results.AddSummaryValue( |
| 124 scalar.ScalarValue(None, 'Total.Score', 'score', total, | 125 scalar.ScalarValue(None, 'Total.Score', 'score', total, |
| 125 description='Geometric mean of the scores of each ' | 126 description='Geometric mean of the scores of each ' |
| 126 'individual benchmark in the Octane ' | 127 'individual benchmark in the Octane ' |
| 127 'benchmark collection.')) | 128 'benchmark collection.')) |
| 129 super(_OctaneMeasurement, self).ValidateAndMeasurePage(page, tab, results) |
| 128 | 130 |
| 129 | 131 |
| 130 class Octane(benchmark.Benchmark): | 132 class Octane(benchmark.Benchmark): |
| 131 """Google's Octane JavaScript benchmark.""" | 133 """Google's Octane JavaScript benchmark.""" |
| 132 test = _OctaneMeasurement | 134 test = _OctaneMeasurement |
| 133 | 135 |
| 134 def CreatePageSet(self, options): | 136 def CreatePageSet(self, options): |
| 135 ps = page_set.PageSet( | 137 ps = page_set.PageSet( |
| 136 archive_data_file='../page_sets/data/octane.json', | 138 archive_data_file='../page_sets/data/octane.json', |
| 137 make_javascript_deterministic=False, | 139 make_javascript_deterministic=False, |
| 138 file_path=os.path.abspath(__file__)) | 140 file_path=os.path.abspath(__file__)) |
| 139 ps.AddPageWithDefaultRunNavigate( | 141 ps.AddPageWithDefaultRunNavigate( |
| 140 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') | 142 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') |
| 141 return ps | 143 return ps |
| OLD | NEW |