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

Side by Side Diff: tools/perf/measurements/rasterize_and_record_micro.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 sys 5 import sys
6 import time 6 import time
7 7
8 from measurements import PageTestMeasurement
8 from telemetry.core.util import TimeoutException 9 from telemetry.core.util import TimeoutException
9 from telemetry.page import page_test 10 from telemetry.page import page_test
10 from telemetry.value import scalar 11 from telemetry.value import scalar
11 12
12 13
13 class RasterizeAndRecordMicro(page_test.PageTest): 14 class RasterizeAndRecordMicro(PageTestMeasurement):
14 def __init__(self): 15 def __init__(self):
15 super(RasterizeAndRecordMicro, self).__init__('') 16 super(RasterizeAndRecordMicro, self).__init__('')
16 self._chrome_branch_number = None 17 self._chrome_branch_number = None
17 18
18 @classmethod 19 @classmethod
19 def AddCommandLineArgs(cls, parser): 20 def AddCommandLineArgs(cls, parser):
20 parser.add_option('--start-wait-time', type='float', 21 parser.add_option('--start-wait-time', type='float',
21 default=2, 22 default=2,
22 help='Wait time before the benchmark is started ' 23 help='Wait time before the benchmark is started '
23 '(must be long enought to load all content)') 24 '(must be long enought to load all content)')
24 parser.add_option('--rasterize-repeat', type='int', 25 parser.add_option('--rasterize-repeat', type='int',
25 default=100, 26 default=100,
26 help='Repeat each raster this many times. Increase ' 27 help='Repeat each raster this many times. Increase '
27 'this value to reduce variance.') 28 'this value to reduce variance.')
28 parser.add_option('--record-repeat', type='int', 29 parser.add_option('--record-repeat', type='int',
29 default=100, 30 default=100,
30 help='Repeat each record this many times. Increase ' 31 help='Repeat each record this many times. Increase '
31 'this value to reduce variance.') 32 'this value to reduce variance.')
32 parser.add_option('--timeout', type='int', 33 parser.add_option('--timeout', type='int',
33 default=120, 34 default=120,
34 help='The length of time to wait for the micro ' 35 help='The length of time to wait for the micro '
35 'benchmark to finish, expressed in seconds.') 36 'benchmark to finish, expressed in seconds.')
36 parser.add_option('--report-detailed-results', 37 parser.add_option('--report-detailed-results',
37 action='store_true', 38 action='store_true',
38 help='Whether to report additional detailed results.') 39 help='Whether to report additional detailed results.')
39 40
40 def CustomizeBrowserOptions(self, options): 41 def CustomizeBrowserOptions(self, options):
42 super(RasterizeAndRecordMicro, self).CustomizeBrowserOptions(options)
41 options.AppendExtraBrowserArgs([ 43 options.AppendExtraBrowserArgs([
42 '--enable-impl-side-painting', 44 '--enable-impl-side-painting',
43 '--enable-threaded-compositing', 45 '--enable-threaded-compositing',
44 '--enable-gpu-benchmarking' 46 '--enable-gpu-benchmarking'
45 ]) 47 ])
46 48
47 def DidStartBrowser(self, browser): 49 def DidStartBrowser(self, browser):
48 # TODO(vmpstr): Remove this temporary workaround when reference build has 50 # TODO(vmpstr): Remove this temporary workaround when reference build has
49 # been updated to branch 1713 or later. 51 # been updated to branch 1713 or later.
50 backend = browser._browser_backend # pylint: disable=W0212 52 backend = browser._browser_backend # pylint: disable=W0212
51 self._chrome_branch_number = getattr(backend, 'chrome_branch_number', None) 53 self._chrome_branch_number = getattr(backend, 'chrome_branch_number', None)
52 if (not self._chrome_branch_number or 54 if (not self._chrome_branch_number or
53 (sys.platform != 'android' and self._chrome_branch_number < 1713)): 55 (sys.platform != 'android' and self._chrome_branch_number < 1713)):
54 raise page_test.TestNotSupportedOnPlatformFailure( 56 raise page_test.TestNotSupportedOnPlatformFailure(
55 'rasterize_and_record_micro requires Chrome branch 1713 ' 57 'rasterize_and_record_micro requires Chrome branch 1713 '
56 'or later. Skipping measurement.') 58 'or later. Skipping measurement.')
57 59
58 def ValidateAndMeasurePage(self, page, tab, results): 60 def ValidateAndMeasurePage(self, page, tab, results):
59 try: 61 try:
60 tab.WaitForDocumentReadyStateToBeComplete() 62 tab.WaitForDocumentReadyStateToBeComplete()
61 except TimeoutException: 63 except TimeoutException:
62 pass 64 pass
63 time.sleep(self.options.start_wait_time) 65 time.sleep(self.options.start_wait_time)
64 66
67 super(RasterizeAndRecordMicro, self).ValidateAndMeasurePage(
68 page, tab, results)
69
65 record_repeat = self.options.record_repeat 70 record_repeat = self.options.record_repeat
66 rasterize_repeat = self.options.rasterize_repeat 71 rasterize_repeat = self.options.rasterize_repeat
67 # Enqueue benchmark 72 # Enqueue benchmark
68 tab.ExecuteJavaScript(""" 73 tab.ExecuteJavaScript("""
69 window.benchmark_results = {}; 74 window.benchmark_results = {};
70 window.benchmark_results.done = false; 75 window.benchmark_results.done = false;
71 window.benchmark_results.id = 76 window.benchmark_results.id =
72 chrome.gpuBenchmarking.runMicroBenchmark( 77 chrome.gpuBenchmarking.runMicroBenchmark(
73 "rasterize_and_record_benchmark", 78 "rasterize_and_record_benchmark",
74 function(value) { 79 function(value) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 results.current_page, 'total_layers', 'count', total_layers)) 144 results.current_page, 'total_layers', 'count', total_layers))
140 results.AddValue(scalar.ScalarValue( 145 results.AddValue(scalar.ScalarValue(
141 results.current_page, 'total_picture_layers', 'count', 146 results.current_page, 'total_picture_layers', 'count',
142 total_picture_layers)) 147 total_picture_layers))
143 results.AddValue(scalar.ScalarValue( 148 results.AddValue(scalar.ScalarValue(
144 results.current_page, 'total_picture_layers_with_no_content', 'count', 149 results.current_page, 'total_picture_layers_with_no_content', 'count',
145 total_picture_layers_with_no_content)) 150 total_picture_layers_with_no_content))
146 results.AddValue(scalar.ScalarValue( 151 results.AddValue(scalar.ScalarValue(
147 results.current_page, 'total_picture_layers_off_screen', 'count', 152 results.current_page, 'total_picture_layers_off_screen', 'count',
148 total_picture_layers_off_screen)) 153 total_picture_layers_off_screen))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698