Mojo C++ bindings: better log message for serialization warnings.
[chromium-blink-merge.git] / tools / perf / measurements / record_per_area.py
blob0804addd1e91476204405d29c3cc8af4603dbee3
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
3 # found in the LICENSE file.
5 import time
7 from measurements import smoothness
8 from telemetry.page import page_test
9 from telemetry.value import scalar
12 class RecordPerArea(page_test.PageTest):
13 def __init__(self):
14 super(RecordPerArea, self).__init__('', True)
16 def AddCommandLineArgs(self, parser):
17 parser.add_option('--start-wait-time', type='float',
18 default=2,
19 help='Wait time before the benchmark is started '
20 '(must be long enought to load all content)')
22 def CustomizeBrowserOptions(self, options):
23 smoothness.Smoothness.CustomizeBrowserOptions(options)
24 options.AppendExtraBrowserArgs([
25 '--enable-impl-side-painting',
26 '--enable-threaded-compositing',
27 '--enable-gpu-benchmarking'
30 def ValidateAndMeasurePage(self, page, tab, results):
31 # Wait until the page has loaded and come to a somewhat steady state.
32 # Needs to be adjusted for every device (~2 seconds for workstation).
33 time.sleep(self.options.start_wait_time)
35 # Enqueue benchmark
36 tab.ExecuteJavaScript("""
37 window.benchmark_results = {};
38 window.benchmark_results.done = false;
39 chrome.gpuBenchmarking.runMicroBenchmark(
40 "picture_record_benchmark",
41 function(value) {
42 window.benchmark_results.done = true;
43 window.benchmark_results.results = value;
44 }, [{width: 1, height: 1},
45 {width: 250, height: 250},
46 {width: 500, height: 500},
47 {width: 750, height: 750},
48 {width: 1000, height: 1000},
49 {width: 256, height: 1024},
50 {width: 1024, height: 256}]);
51 """)
53 tab.WaitForJavaScriptExpression('window.benchmark_results.done', 300)
55 all_data = tab.EvaluateJavaScript('window.benchmark_results.results')
56 for data in all_data:
57 width = data['width']
58 height = data['height']
59 area = width * height
60 time_ms = data['time_ms']
62 results.AddValue(scalar.ScalarValue(
63 results.current_page, 'area_%07d_%dx%d' % (area, width, height),
64 'ms', time_ms))