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

Side by Side Diff: tools/perf/measurements/record_per_area.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 import time 5 import time
6 6
7 from measurements import PageTestMeasurement
7 from measurements import smoothness 8 from measurements import smoothness
8 from telemetry.page import page_test
9 from telemetry.value import scalar 9 from telemetry.value import scalar
10 10
11 11
12 class RecordPerArea(page_test.PageTest): 12 class RecordPerArea(PageTestMeasurement):
13 def __init__(self): 13 def __init__(self):
14 super(RecordPerArea, self).__init__('', True) 14 super(RecordPerArea, self).__init__('', True)
15 15
16 def AddCommandLineArgs(self, parser): 16 def AddCommandLineArgs(self, parser):
17 parser.add_option('--start-wait-time', type='float', 17 parser.add_option('--start-wait-time', type='float',
18 default=2, 18 default=2,
19 help='Wait time before the benchmark is started ' 19 help='Wait time before the benchmark is started '
20 '(must be long enought to load all content)') 20 '(must be long enought to load all content)')
21 21
22 def CustomizeBrowserOptions(self, options): 22 def CustomizeBrowserOptions(self, options):
23 smoothness.Smoothness.CustomizeBrowserOptions(options) 23 super(RecordPerArea, self).CustomizeBrowserOptions(options)
24 smoothness.Smoothness.CustomizeBrowserOptionsClass(options)
24 options.AppendExtraBrowserArgs([ 25 options.AppendExtraBrowserArgs([
25 '--enable-impl-side-painting', 26 '--enable-impl-side-painting',
26 '--enable-threaded-compositing', 27 '--enable-threaded-compositing',
27 '--enable-gpu-benchmarking' 28 '--enable-gpu-benchmarking'
28 ]) 29 ])
29 30
30 def ValidateAndMeasurePage(self, page, tab, results): 31 def ValidateAndMeasurePage(self, page, tab, results):
31 # Wait until the page has loaded and come to a somewhat steady state. 32 # 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 # Needs to be adjusted for every device (~2 seconds for workstation).
33 time.sleep(self.options.start_wait_time) 34 time.sleep(self.options.start_wait_time)
34 35
36 super(RecordPerArea, self).ValidateAndMeasurePage(page, tab, results)
37
35 # Enqueue benchmark 38 # Enqueue benchmark
36 tab.ExecuteJavaScript(""" 39 tab.ExecuteJavaScript("""
37 window.benchmark_results = {}; 40 window.benchmark_results = {};
38 window.benchmark_results.done = false; 41 window.benchmark_results.done = false;
39 chrome.gpuBenchmarking.runMicroBenchmark( 42 chrome.gpuBenchmarking.runMicroBenchmark(
40 "picture_record_benchmark", 43 "picture_record_benchmark",
41 function(value) { 44 function(value) {
42 window.benchmark_results.done = true; 45 window.benchmark_results.done = true;
43 window.benchmark_results.results = value; 46 window.benchmark_results.results = value;
44 }, [{width: 1, height: 1}, 47 }, [{width: 1, height: 1},
(...skipping 10 matching lines...) Expand all
55 all_data = tab.EvaluateJavaScript('window.benchmark_results.results') 58 all_data = tab.EvaluateJavaScript('window.benchmark_results.results')
56 for data in all_data: 59 for data in all_data:
57 width = data['width'] 60 width = data['width']
58 height = data['height'] 61 height = data['height']
59 area = width * height 62 area = width * height
60 time_ms = data['time_ms'] 63 time_ms = data['time_ms']
61 64
62 results.AddValue(scalar.ScalarValue( 65 results.AddValue(scalar.ScalarValue(
63 results.current_page, 'area_%07d_%dx%d' % (area, width, height), 66 results.current_page, 'area_%07d_%dx%d' % (area, width, height),
64 'ms', time_ms)) 67 'ms', time_ms))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698