| 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 spaceport.io's PerfMarks benchmark.""" | 5 """Runs spaceport.io's PerfMarks benchmark.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 from telemetry import benchmark | 10 from telemetry import benchmark |
| 11 from telemetry import page as page_module | 11 from telemetry import page as page_module |
| 12 from telemetry.core import util | 12 from telemetry.core import util |
| 13 from telemetry.page import page_set | 13 from telemetry.page import page_set |
| 14 from telemetry.page import page_test | 14 from telemetry.page import page_test |
| 15 from telemetry.value import improvement_direction |
| 15 from telemetry.value import list_of_scalar_values | 16 from telemetry.value import list_of_scalar_values |
| 16 from telemetry.value import scalar | 17 from telemetry.value import scalar |
| 17 | 18 |
| 18 DESCRIPTIONS = { | 19 DESCRIPTIONS = { |
| 19 'canvasDrawImageFullClear': | 20 'canvasDrawImageFullClear': |
| 20 'Using a canvas element to render. Bitmaps are blitted to the canvas ' | 21 'Using a canvas element to render. Bitmaps are blitted to the canvas ' |
| 21 'using the "drawImage" function and the canvas is fully cleared at ' | 22 'using the "drawImage" function and the canvas is fully cleared at ' |
| 22 'the beginning of each frame.', | 23 'the beginning of each frame.', |
| 23 'canvasDrawImageFullClearAlign': | 24 'canvasDrawImageFullClearAlign': |
| 24 'Same as canvasDrawImageFullClear except all "x" and "y" values are ' | 25 'Same as canvasDrawImageFullClear except all "x" and "y" values are ' |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 'JSON.stringify(window.__results)')) | 85 'JSON.stringify(window.__results)')) |
| 85 for key in result_dict: | 86 for key in result_dict: |
| 86 chart, trace = key.split('.', 1) | 87 chart, trace = key.split('.', 1) |
| 87 results.AddValue(scalar.ScalarValue( | 88 results.AddValue(scalar.ScalarValue( |
| 88 results.current_page, '%s.%s'% (chart, trace), | 89 results.current_page, '%s.%s'% (chart, trace), |
| 89 'objects (bigger is better)', float(result_dict[key]), | 90 'objects (bigger is better)', float(result_dict[key]), |
| 90 important=False, description=DESCRIPTIONS.get(chart))) | 91 important=False, description=DESCRIPTIONS.get(chart))) |
| 91 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 92 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 92 results.current_page, 'Score', 'objects (bigger is better)', | 93 results.current_page, 'Score', 'objects (bigger is better)', |
| 93 [float(x) for x in result_dict.values()], | 94 [float(x) for x in result_dict.values()], |
| 94 description='Combined score for all parts of the spaceport benchmark.')) | 95 description='Combined score for all parts of the spaceport benchmark.', |
| 96 improvement_direction=improvement_direction.UP)) |
| 95 | 97 |
| 96 | 98 |
| 97 # crbug.com/166703: This test frequently times out on Windows. | 99 # crbug.com/166703: This test frequently times out on Windows. |
| 98 @benchmark.Disabled('mac', 'win') | 100 @benchmark.Disabled('mac', 'win') |
| 99 class Spaceport(benchmark.Benchmark): | 101 class Spaceport(benchmark.Benchmark): |
| 100 """spaceport.io's PerfMarks benchmark. | 102 """spaceport.io's PerfMarks benchmark. |
| 101 | 103 |
| 102 http://spaceport.io/community/perfmarks | 104 http://spaceport.io/community/perfmarks |
| 103 | 105 |
| 104 This test performs 3 animations (rotate, translate, scale) using a variety of | 106 This test performs 3 animations (rotate, translate, scale) using a variety of |
| 105 methods (css, webgl, canvas, etc) and reports the number of objects that can | 107 methods (css, webgl, canvas, etc) and reports the number of objects that can |
| 106 be simultaneously animated while still achieving 30FPS. | 108 be simultaneously animated while still achieving 30FPS. |
| 107 """ | 109 """ |
| 108 test = _SpaceportMeasurement | 110 test = _SpaceportMeasurement |
| 109 | 111 |
| 110 def CreatePageSet(self, options): | 112 def CreatePageSet(self, options): |
| 111 spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', | 113 spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', |
| 112 'data', 'third_party', 'spaceport') | 114 'data', 'third_party', 'spaceport') |
| 113 ps = page_set.PageSet(file_path=spaceport_dir) | 115 ps = page_set.PageSet(file_path=spaceport_dir) |
| 114 ps.AddUserStory(page_module.Page('file://index.html', ps, ps.base_dir)) | 116 ps.AddUserStory(page_module.Page('file://index.html', ps, ps.base_dir)) |
| 115 return ps | 117 return ps |
| OLD | NEW |