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

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

Issue 376243003: Update Canvasmark to use results.AddValue(...). (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 | no next file » | 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 """Runs Canvasmark HTML5, Canvas 2D rendering and javascript benchmark. 5 """Runs Canvasmark HTML5, Canvas 2D rendering and javascript benchmark.
6 6
7 CanvasMark tests the HTML5 <canvas> rendering performance for commonly used 7 CanvasMark tests the HTML5 <canvas> rendering performance for commonly used
8 operations in HTML5 games: bitmaps, canvas drawing, alpha blending, polygon 8 operations in HTML5 games: bitmaps, canvas drawing, alpha blending, polygon
9 fills, shadows and text functions. 9 fills, shadows and text functions.
10 """ 10 """
11 11
12 import os 12 import os
13 13
14 from telemetry import benchmark 14 from telemetry import benchmark
15 from telemetry.page import page_measurement 15 from telemetry.page import page_measurement
16 from telemetry.page import page_set 16 from telemetry.page import page_set
17 from telemetry.value import scalar
17 18
18 19
19 class _CanvasMarkMeasurement(page_measurement.PageMeasurement): 20 class _CanvasMarkMeasurement(page_measurement.PageMeasurement):
20 21
21 def WillNavigateToPage(self, page, tab): 22 def WillNavigateToPage(self, page, tab):
22 page.script_to_evaluate_on_commit = """ 23 page.script_to_evaluate_on_commit = """
23 var __results = []; 24 var __results = [];
24 var __real_log = window.console.log; 25 var __real_log = window.console.log;
25 window.console.log = function(msg) { 26 window.console.log = function(msg) {
26 __results.push(msg); 27 __results.push(msg);
27 __real_log.apply(this, [msg]); 28 __real_log.apply(this, [msg]);
28 } 29 }
29 """ 30 """
30 31
31 def MeasurePage(self, _, tab, results): 32 def MeasurePage(self, _, tab, results):
32 tab.WaitForJavaScriptExpression('__results.length == 8', 300) 33 tab.WaitForJavaScriptExpression('__results.length == 8', 300)
33 results_log = tab.EvaluateJavaScript('__results') 34 results_log = tab.EvaluateJavaScript('__results')
34 total = 0 35 total = 0
35 for output in results_log: 36 for output in results_log:
36 # Split the results into score and test name. 37 # Split the results into score and test name.
37 # results log e.g., "489 [Test 1 - Asteroids - Bitmaps]" 38 # results log e.g., "489 [Test 1 - Asteroids - Bitmaps]"
38 score_and_name = output.split(' [', 2) 39 score_and_name = output.split(' [', 2)
39 assert len(score_and_name) == 2, \ 40 assert len(score_and_name) == 2, \
40 'Unexpected result format "%s"' % score_and_name 41 'Unexpected result format "%s"' % score_and_name
41 score = int(score_and_name[0]) 42 score = int(score_and_name[0])
42 name = score_and_name[1][:-1] 43 name = score_and_name[1][:-1]
43 results.Add(name, 'score', score, data_type='unimportant') 44 results.AddValue(scalar.ScalarValue(
45 results.current_page, name, 'score', score, important=False))
44 # Aggregate total score for all tests. 46 # Aggregate total score for all tests.
45 total += score 47 total += score
46 results.Add('Score', 'score', total) 48 results.AddValue(scalar.ScalarValue(
49 results.current_page, 'Score', 'score', total))
47 50
48 51
49 @benchmark.Disabled 52 @benchmark.Disabled
50 class CanvasMark(benchmark.Benchmark): 53 class CanvasMark(benchmark.Benchmark):
51 test = _CanvasMarkMeasurement 54 test = _CanvasMarkMeasurement
52 55
53 def CreatePageSet(self, options): 56 def CreatePageSet(self, options):
54 ps = page_set.PageSet( 57 ps = page_set.PageSet(
55 file_path=os.path.abspath(__file__), 58 file_path=os.path.abspath(__file__),
56 archive_data_file='../page_sets/data/canvasmark.json', 59 archive_data_file='../page_sets/data/canvasmark.json',
57 make_javascript_deterministic=False) 60 make_javascript_deterministic=False)
58 ps.AddPageWithDefaultRunNavigate( 61 ps.AddPageWithDefaultRunNavigate(
59 'http://www.kevs3d.co.uk/dev/canvasmark/?auto=true') 62 'http://www.kevs3d.co.uk/dev/canvasmark/?auto=true')
60 return ps 63 return ps
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698