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

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

Issue 372163002: Refactor sunspider and scirra Telemetry benchmarks to use AddValue call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Scirra WebGL and Canvas2D rendering benchmark suite. 5 """Scirra WebGL and Canvas2D rendering benchmark suite.
6 6
7 The Scirra WebGL performance test measures the number of 2D triangles 7 The Scirra WebGL performance test measures the number of 2D triangles
8 represented onscreen when the animation reaches the 30 FPS threshold. 8 represented onscreen when the animation reaches the 30 FPS threshold.
9 """ 9 """
10 10
11 import os 11 import os
12 12
13 from telemetry import benchmark 13 from telemetry import benchmark
14 from telemetry.page import page_measurement 14 from telemetry.page import page_measurement
15 from telemetry.page import page_set 15 from telemetry.page import page_set
16 from telemetry.value import scalar
16 17
17 18
18 class _ScirraMeasurement(page_measurement.PageMeasurement): 19 class _ScirraMeasurement(page_measurement.PageMeasurement):
19 20
20 def WillNavigateToPage(self, page, tab): 21 def WillNavigateToPage(self, page, tab):
21 page.script_to_evaluate_on_commit = 'window.sprites = 0;' 22 page.script_to_evaluate_on_commit = 'window.sprites = 0;'
22 23
23 def MeasurePage(self, _, tab, results): 24 def MeasurePage(self, _, tab, results):
24 object_count = '$objectcount$' 25 object_count = '$objectcount$'
25 fps = '$fps$' 26 fps = '$fps$'
(...skipping 14 matching lines...) Expand all
40 window.sprites = window.cr_getC2Runtime().%(object_count)s; 41 window.sprites = window.cr_getC2Runtime().%(object_count)s;
41 return true; 42 return true;
42 } else { 43 } else {
43 return false; 44 return false;
44 } 45 }
45 }; 46 };
46 IsTestDone(); 47 IsTestDone();
47 """ % {'tickcount': tickcount, 'fps': fps, 'object_count': object_count} 48 """ % {'tickcount': tickcount, 'fps': fps, 'object_count': object_count}
48 tab.WaitForJavaScriptExpression(js_is_done, 300) 49 tab.WaitForJavaScriptExpression(js_is_done, 300)
49 total = int(tab.EvaluateJavaScript('window.sprites')) 50 total = int(tab.EvaluateJavaScript('window.sprites'))
50 results.Add('Count', 'count', total) 51 results.AddValue(scalar.ScalarValue(
51 52 results.current_page, 'Count', 'count', total))
52 53
53 @benchmark.Disabled 54 @benchmark.Disabled
54 class ScirraBenchmark(benchmark.Benchmark): 55 class ScirraBenchmark(benchmark.Benchmark):
55 """WebGL and Canvas2D rendering benchmark suite.""" 56 """WebGL and Canvas2D rendering benchmark suite."""
56 test = _ScirraMeasurement 57 test = _ScirraMeasurement
57 def CreatePageSet(self, options): 58 def CreatePageSet(self, options):
58 ps = page_set.PageSet( 59 ps = page_set.PageSet(
59 archive_data_file='../page_sets/data/scirra.json', 60 archive_data_file='../page_sets/data/scirra.json',
60 make_javascript_deterministic=False, 61 make_javascript_deterministic=False,
61 file_path=os.path.abspath(__file__)) 62 file_path=os.path.abspath(__file__))
62 for url in ('http://www.scirra.com/labs/renderperf3/', 63 for url in ('http://www.scirra.com/labs/renderperf3/',
63 'http://www.scirra.com/demos/c2/renderperfgl/', 64 'http://www.scirra.com/demos/c2/renderperfgl/',
64 'http://www.scirra.com/demos/c2/renderperf2d/'): 65 'http://www.scirra.com/demos/c2/renderperf2d/'):
65 ps.AddPageWithDefaultRunNavigate(url) 66 ps.AddPageWithDefaultRunNavigate(url)
66 return ps 67 return ps
67 68
68 69
69 70
OLDNEW
« no previous file with comments | « no previous file | tools/perf/benchmarks/sunspider.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698