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

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

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Add a common subclass to measurements. Created 6 years, 1 month 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
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 measurements import PageTestMeasurement
13 from telemetry import benchmark 14 from telemetry import benchmark
14 from telemetry.page import page_set 15 from telemetry.page import page_set
15 from telemetry.page import page_test
16 from telemetry.value import scalar 16 from telemetry.value import scalar
17 17
18 18
19 class _ScirraMeasurement(page_test.PageTest): 19 class _ScirraMeasurement(PageTestMeasurement):
20 20
21 def WillNavigateToPage(self, page, tab): 21 def WillNavigateToPage(self, page, tab):
22 page.script_to_evaluate_on_commit = 'window.sprites = 0;' 22 page.script_to_evaluate_on_commit = 'window.sprites = 0;'
23 23
24 def ValidateAndMeasurePage(self, _, tab, results): 24 def ValidateAndMeasurePage(self, page, tab, results):
25 object_count = '$objectcount$' 25 object_count = '$objectcount$'
26 fps = '$fps$' 26 fps = '$fps$'
27 tickcount = '$tickcount$' 27 tickcount = '$tickcount$'
28 # For http://www.scirra.com/labs/renderperf3/, JavaScript generated by 28 # For http://www.scirra.com/labs/renderperf3/, JavaScript generated by
29 # Construct 2 has different variables for Objects, fps and tickcount. 29 # Construct 2 has different variables for Objects, fps and tickcount.
30 if 'renderperf3' in tab.url: 30 if 'renderperf3' in tab.url:
31 object_count = '$d' 31 object_count = '$d'
32 fps = 'Rb' 32 fps = 'Rb'
33 tickcount = 'Ff' 33 tickcount = 'Ff'
34 34
35 # Updates object count variable, when the FPS reaches 30 threshold and 35 # Updates object count variable, when the FPS reaches 30 threshold and
36 # tickcounts to reach value greater than 500(just to stablize frames). 36 # tickcounts to reach value greater than 500(just to stablize frames).
37 js_is_done = """ 37 js_is_done = """
38 var IsTestDone = function() { 38 var IsTestDone = function() {
39 if (window.cr_getC2Runtime().%(tickcount)s > 500 && 39 if (window.cr_getC2Runtime().%(tickcount)s > 500 &&
40 window.cr_getC2Runtime().%(fps)s == 30) { 40 window.cr_getC2Runtime().%(fps)s == 30) {
41 window.sprites = window.cr_getC2Runtime().%(object_count)s; 41 window.sprites = window.cr_getC2Runtime().%(object_count)s;
42 return true; 42 return true;
43 } else { 43 } else {
44 return false; 44 return false;
45 } 45 }
46 }; 46 };
47 IsTestDone(); 47 IsTestDone();
48 """ % {'tickcount': tickcount, 'fps': fps, 'object_count': object_count} 48 """ % {'tickcount': tickcount, 'fps': fps, 'object_count': object_count}
49 tab.WaitForJavaScriptExpression(js_is_done, 300) 49 tab.WaitForJavaScriptExpression(js_is_done, 300)
50 total = int(tab.EvaluateJavaScript('window.sprites')) 50 total = int(tab.EvaluateJavaScript('window.sprites'))
51 results.AddValue(scalar.ScalarValue( 51 results.AddValue(scalar.ScalarValue(
52 results.current_page, 'Count', 'count', total)) 52 results.current_page, 'Count', 'count', total))
53 super(_ScirraMeasurement, self).ValidateAndMeasurePage(page, tab, results)
53 54
54 @benchmark.Disabled 55 @benchmark.Disabled
55 class ScirraBenchmark(benchmark.Benchmark): 56 class ScirraBenchmark(benchmark.Benchmark):
56 """WebGL and Canvas2D rendering benchmark suite.""" 57 """WebGL and Canvas2D rendering benchmark suite."""
57 test = _ScirraMeasurement 58 test = _ScirraMeasurement
58 def CreatePageSet(self, options): 59 def CreatePageSet(self, options):
59 ps = page_set.PageSet( 60 ps = page_set.PageSet(
60 archive_data_file='../page_sets/data/scirra.json', 61 archive_data_file='../page_sets/data/scirra.json',
61 make_javascript_deterministic=False, 62 make_javascript_deterministic=False,
62 file_path=os.path.abspath(__file__)) 63 file_path=os.path.abspath(__file__))
63 for url in ('http://www.scirra.com/labs/renderperf3/', 64 for url in ('http://www.scirra.com/labs/renderperf3/',
64 'http://www.scirra.com/demos/c2/renderperfgl/', 65 'http://www.scirra.com/demos/c2/renderperfgl/',
65 'http://www.scirra.com/demos/c2/renderperf2d/'): 66 'http://www.scirra.com/demos/c2/renderperf2d/'):
66 ps.AddPageWithDefaultRunNavigate(url) 67 ps.AddPageWithDefaultRunNavigate(url)
67 return ps 68 return ps
68 69
69 70
70 71
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698