Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: tools/perf/benchmarks/spaceport.py

Issue 391183002: Delete trace-info.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed descriptions in smoothness_controller. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/perf/benchmarks/octane.py ('k') | tools/perf/benchmarks/sunspider.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.core import util 11 from telemetry.core import util
12 from telemetry.page import page_measurement 12 from telemetry.page import page_measurement
13 from telemetry.page import page_set 13 from telemetry.page import page_set
14 from telemetry.value import list_of_scalar_values 14 from telemetry.value import list_of_scalar_values
15 from telemetry.value import scalar 15 from telemetry.value import scalar
16 16
17 DESCRIPTIONS = {
18 'canvasDrawImageFullClear':
19 'Using a canvas element to render. Bitmaps are blitted to the canvas '
20 'using the "drawImage" function and the canvas is fully cleared at '
21 'the beginning of each frame.',
22 'canvasDrawImageFullClearAlign':
23 'Same as canvasDrawImageFullClear except all "x" and "y" values are '
24 'rounded to the nearest integer. This can be more efficient on '
25 'translate on certain browsers.',
26 'canvasDrawImagePartialClear':
27 'Using a canvas element to render. Bitmaps are blitted to the canvas '
28 'using the "drawImage" function and pixels drawn in the last frame '
29 'are cleared to the clear color at the beginning of each frame. '
30 'This is generally slower on hardware accelerated implementations, '
31 'but sometimes faster on CPU-based implementations.',
32 'canvasDrawImagePartialClearAlign':
33 'Same as canvasDrawImageFullClearAlign but only partially clearing '
34 'the canvas each frame.',
35 'css2dBackground':
36 'Using div elements that have a background image specified using CSS '
37 'styles. These div elements are translated, scaled, and rotated using '
38 'CSS-2D transforms.',
39 'css2dImg':
40 'Same as css2dBackground, but using img elements instead of div '
41 'elements.',
42 'css3dBackground':
43 'Same as css2dBackground, but using CSS-3D transforms.',
44 'css3dImg':
45 'Same as css2dImage but using CSS-3D tranforms.',
46 }
47
17 48
18 class _SpaceportMeasurement(page_measurement.PageMeasurement): 49 class _SpaceportMeasurement(page_measurement.PageMeasurement):
19 def __init__(self): 50 def __init__(self):
20 super(_SpaceportMeasurement, self).__init__() 51 super(_SpaceportMeasurement, self).__init__()
21 52
22 def CustomizeBrowserOptions(self, options): 53 def CustomizeBrowserOptions(self, options):
23 options.AppendExtraBrowserArgs('--disable-gpu-vsync') 54 options.AppendExtraBrowserArgs('--disable-gpu-vsync')
24 55
25 def MeasurePage(self, page, tab, results): 56 def MeasurePage(self, page, tab, results):
26 tab.WaitForJavaScriptExpression( 57 tab.WaitForJavaScriptExpression(
27 '!document.getElementById("start-performance-tests").disabled', 60) 58 '!document.getElementById("start-performance-tests").disabled', 60)
28 59
29 tab.ExecuteJavaScript(""" 60 tab.ExecuteJavaScript("""
30 window.__results = {}; 61 window.__results = {};
31 window.console.log = function(str) { 62 window.console.log = function(str) {
32 if (!str) return; 63 if (!str) return;
33 var key_val = str.split(': '); 64 var key_val = str.split(': ');
34 if (!key_val.length == 2) return; 65 if (!key_val.length == 2) return;
35 __results[key_val[0]] = key_val[1]; 66 __results[key_val[0]] = key_val[1];
36 }; 67 };
37 document.getElementById('start-performance-tests').click(); 68 document.getElementById('start-performance-tests').click();
38 """) 69 """)
39 70
40 num_results = 0 71 num_results = 0
41 num_tests_in_spaceport = 24 72 num_tests_in_spaceport = 24
42 while num_results < num_tests_in_spaceport: 73 while num_results < num_tests_in_spaceport:
43 tab.WaitForJavaScriptExpression( 74 tab.WaitForJavaScriptExpression(
44 'Object.keys(window.__results).length > %d' % num_results, 180) 75 'Object.keys(window.__results).length > %d' % num_results, 180)
45 num_results = tab.EvaluateJavaScript( 76 num_results = tab.EvaluateJavaScript(
46 'Object.keys(window.__results).length') 77 'Object.keys(window.__results).length')
47 logging.info('Completed test %d of %d' % 78 logging.info('Completed test %d of %d' %
48 (num_results, num_tests_in_spaceport)) 79 (num_results, num_tests_in_spaceport))
49 80
50 result_dict = eval(tab.EvaluateJavaScript( 81 result_dict = eval(tab.EvaluateJavaScript(
51 'JSON.stringify(window.__results)')) 82 'JSON.stringify(window.__results)'))
52 for key in result_dict: 83 for key in result_dict:
53 chart, trace = key.split('.', 1) 84 chart, trace = key.split('.', 1)
54 results.AddValue(scalar.ScalarValue( 85 results.AddValue(scalar.ScalarValue(
55 results.current_page, '%s.%s'% (chart, trace), 86 results.current_page, '%s.%s'% (chart, trace),
56 'objects (bigger is better)', float(result_dict[key]), 87 'objects (bigger is better)', float(result_dict[key]),
57 important=False)) 88 important=False, description=DESCRIPTIONS.get(chart)))
58 results.AddValue(list_of_scalar_values.ListOfScalarValues( 89 results.AddValue(list_of_scalar_values.ListOfScalarValues(
59 results.current_page, 'Score', 'objects (bigger is better)', 90 results.current_page, 'Score', 'objects (bigger is better)',
60 [float(x) for x in result_dict.values()])) 91 [float(x) for x in result_dict.values()],
92 description='Combined score for all parts of the spaceport benchmark.'))
61 93
62 94
63 # crbug.com/166703: This test frequently times out on Windows. 95 # crbug.com/166703: This test frequently times out on Windows.
64 @benchmark.Disabled('mac', 'win') 96 @benchmark.Disabled('mac', 'win')
65 class Spaceport(benchmark.Benchmark): 97 class Spaceport(benchmark.Benchmark):
66 """spaceport.io's PerfMarks benchmark.""" 98 """spaceport.io's PerfMarks benchmark."""
67 test = _SpaceportMeasurement 99 test = _SpaceportMeasurement
68 100
69 def CreatePageSet(self, options): 101 def CreatePageSet(self, options):
70 spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', 102 spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test',
71 'data', 'third_party', 'spaceport') 103 'data', 'third_party', 'spaceport')
72 ps = page_set.PageSet(file_path=spaceport_dir) 104 ps = page_set.PageSet(file_path=spaceport_dir)
73 ps.AddPageWithDefaultRunNavigate('file://index.html') 105 ps.AddPageWithDefaultRunNavigate('file://index.html')
74 return ps 106 return ps
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/octane.py ('k') | tools/perf/benchmarks/sunspider.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698