| 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 _GB = 1024 * 1024 * 1024 |
| 24 | 24 |
| 25 class _OctaneMeasurement(page_measurement.PageMeasurement): | 25 class _OctaneMeasurement(page_measurement.PageMeasurement): |
| 26 def __init__(self): | 26 def __init__(self): |
| 27 super(_OctaneMeasurement, self).__init__() | 27 super(_OctaneMeasurement, self).__init__() |
| 28 self._power_metric = power.PowerMetric() | 28 self._power_metric = None |
| 29 | 29 |
| 30 def CustomizeBrowserOptions(self, options): | 30 def CustomizeBrowserOptions(self, options): |
| 31 power.PowerMetric.CustomizeBrowserOptions(options) | 31 power.PowerMetric.CustomizeBrowserOptions(options) |
| 32 | 32 |
| 33 def WillStartBrowser(self, browser): |
| 34 self._power_metric = power.PowerMetric(browser) |
| 33 | 35 |
| 34 def WillNavigateToPage(self, page, tab): | 36 def WillNavigateToPage(self, page, tab): |
| 35 if tab.browser.memory_stats['SystemTotalPhysicalMemory'] < 1 * _GB: | 37 if tab.browser.memory_stats['SystemTotalPhysicalMemory'] < 1 * _GB: |
| 36 skipBenchmarks = '"zlib"' | 38 skipBenchmarks = '"zlib"' |
| 37 else: | 39 else: |
| 38 skipBenchmarks = '' | 40 skipBenchmarks = '' |
| 39 page.script_to_evaluate_on_commit = """ | 41 page.script_to_evaluate_on_commit = """ |
| 40 var __results = []; | 42 var __results = []; |
| 41 var __real_log = window.console.log; | 43 var __real_log = window.console.log; |
| 42 window.console.log = function(msg) { | 44 window.console.log = function(msg) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 test = _OctaneMeasurement | 82 test = _OctaneMeasurement |
| 81 | 83 |
| 82 def CreatePageSet(self, options): | 84 def CreatePageSet(self, options): |
| 83 ps = page_set.PageSet( | 85 ps = page_set.PageSet( |
| 84 archive_data_file='../page_sets/data/octane.json', | 86 archive_data_file='../page_sets/data/octane.json', |
| 85 make_javascript_deterministic=False, | 87 make_javascript_deterministic=False, |
| 86 file_path=os.path.abspath(__file__)) | 88 file_path=os.path.abspath(__file__)) |
| 87 ps.AddPageWithDefaultRunNavigate( | 89 ps.AddPageWithDefaultRunNavigate( |
| 88 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') | 90 'http://octane-benchmark.googlecode.com/svn/latest/index.html?auto=1') |
| 89 return ps | 91 return ps |
| OLD | NEW |