Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / tools / perf / measurements / record_per_area.py
blobcb89e1133f14855eebb079265de84798664036c8
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, start_wait_time=2):
14 super(RecordPerArea, self).__init__('', True)
15 self._start_wait_time = start_wait_time
17 def CustomizeBrowserOptions(self, options):
18 smoothness.Smoothness.CustomizeBrowserOptions(options)
19 options.AppendExtraBrowserArgs([
20 '--enable-impl-side-painting',
21 '--enable-threaded-compositing',
22 '--enable-gpu-benchmarking'
25 def ValidateAndMeasurePage(self, page, tab, results):
26 # Wait until the page has loaded and come to a somewhat steady state.
27 # Needs to be adjusted for every device (~2 seconds for workstation).
28 time.sleep(self._start_wait_time)
30 # Enqueue benchmark
31 tab.ExecuteJavaScript("""
32 window.benchmark_results = {};
33 window.benchmark_results.done = false;
34 chrome.gpuBenchmarking.runMicroBenchmark(
35 "picture_record_benchmark",
36 function(value) {
37 window.benchmark_results.done = true;
38 window.benchmark_results.results = value;
39 }, [{width: 1, height: 1},
40 {width: 250, height: 250},
41 {width: 500, height: 500},
42 {width: 750, height: 750},
43 {width: 1000, height: 1000},
44 {width: 256, height: 1024},
45 {width: 1024, height: 256}]);
46 """)
48 tab.WaitForJavaScriptExpression('window.benchmark_results.done', 300)
50 all_data = tab.EvaluateJavaScript('window.benchmark_results.results')
51 for data in all_data:
52 width = data['width']
53 height = data['height']
54 area = width * height
55 time_ms = data['time_ms']
57 results.AddValue(scalar.ScalarValue(
58 results.current_page, 'area_%07d_%dx%d' % (area, width, height),
59 'ms', time_ms))