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

Side by Side Diff: tools/perf/measurements/blink_style.py

Issue 1100853003: Make quiesence test best-effort for the blink_style benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip updateStyle measurement when resolverAccessCount is missing Created 5 years, 8 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 | « tools/perf/benchmarks/blink_style.py ('k') | tools/perf/measurements/blink_style_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 from itertools import starmap 5 from itertools import starmap
6 from collections import defaultdict 6 from collections import defaultdict
7
8 from telemetry.core import util 7 from telemetry.core import util
8 from telemetry.core import exceptions
9 from telemetry.page import page_test 9 from telemetry.page import page_test
10 from telemetry.value import scalar 10 from telemetry.value import scalar
11 11
12 from measurements import timeline_controller 12 from measurements import timeline_controller
13 13
14 14
15 class BlinkStyle(page_test.PageTest): 15 class BlinkStyle(page_test.PageTest):
16 def __init__(self): 16 def __init__(self):
17 super(BlinkStyle, self).__init__() 17 super(BlinkStyle, self).__init__()
18 self._controller = None 18 self._controller = None
19 19
20 def WillNavigateToPage(self, page, tab): 20 def WillNavigateToPage(self, page, tab):
21 self._controller = timeline_controller.TimelineController() 21 self._controller = timeline_controller.TimelineController()
22 self._controller.trace_categories = 'blink,benchmark,blink.console' 22 self._controller.trace_categories = 'blink_style,blink.console'
23 self._controller.SetUp(page, tab) 23 self._controller.SetUp(page, tab)
24 self._controller.Start(tab) 24 self._controller.Start(tab)
25 25
26 def CleanUpAfterPage(self, page, tab): 26 def CleanUpAfterPage(self, page, tab):
27 if self._controller: 27 if self._controller:
28 self._controller.CleanUp(tab) 28 self._controller.CleanUp(tab)
29 29
30 def ValidateAndMeasurePage(self, page, tab, results): 30 def ValidateAndMeasurePage(self, page, tab, results):
31 tab.WaitForDocumentReadyStateToBeComplete() 31 tab.ExecuteJavaScript('console.time("wait-for-quiescence");')
32 if not util.WaitFor(tab.HasReachedQuiescence, 30): 32 try:
33 raise page_test.MeasurementFailure('Failed to reach quiesence.') 33 util.WaitFor(tab.HasReachedQuiescence, 15)
34 except exceptions.TimeoutException:
dtu 2015/04/27 13:02:20 ? Can you add a comment explaining why you want to
35 pass
36 tab.ExecuteJavaScript('console.timeEnd("wait-for-quiescence");')
34 37
35 tab.ExecuteJavaScript( 38 tab.ExecuteJavaScript(
36 'console.time("style-update");' 39 'console.time("style-update");'
37 # Occasionally documents will break the APIs we need. 40 # Occasionally documents will break the APIs we need.
38 'try {' 41 'try {'
39 # Invalidate style for the whole document. 42 # Invalidate style for the whole document.
40 ' document && (document.documentElement.lang += "z");' 43 ' document && (document.documentElement.lang += "z");'
41 # Force a style update (but not layout). 44 # Force a style update (but not layout).
42 ' getComputedStyle(document.documentElement).color;' 45 ' getComputedStyle(document.documentElement).color;'
43 '} catch (e) {}' 46 '} catch (e) {}'
(...skipping 11 matching lines...) Expand all
55 def duration(event): 58 def duration(event):
56 if event.has_thread_timestamps: 59 if event.has_thread_timestamps:
57 return event.thread_duration 60 return event.thread_duration
58 else: 61 else:
59 return event.duration 62 return event.duration
60 63
61 for event in renderer.all_slices: 64 for event in renderer.all_slices:
62 if (event.name == 'Document::updateStyle' 65 if (event.name == 'Document::updateStyle'
63 and event.start >= marker.start 66 and event.start >= marker.start
64 and event.end <= marker.end): 67 and event.end <= marker.end):
65 access_count = event.args['resolverAccessCount'] 68 access_count = event.get('resolverAccessCount')
69 if access_count is None:
70 # absent in earlier versions
71 continue
66 min_access_count = 50 72 min_access_count = 50
67 73
68 if access_count >= min_access_count: 74 if access_count >= min_access_count:
69 result = 1000 * (duration(event) / access_count) 75 result = 1000 * (duration(event) / access_count)
70 results.AddValue(scalar.ScalarValue( 76 results.AddValue(scalar.ScalarValue(
71 page, 'update_style', 'ms/1000 elements', result)) 77 page, 'update_style', 'ms/1000 elements', result))
72 78
73 class ParserEvent(object): 79 class ParserEvent(object):
74 def __init__(self, summary_event, tokenize_event, parse_event): 80 def __init__(self, summary_event, tokenize_event, parse_event):
75 min_sheet_length = 1000 81 min_sheet_length = 1000
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 tokens = sum(event.tokens for event in events) 118 tokens = sum(event.tokens for event in events)
113 length = sum(event.length for event in events) 119 length = sum(event.length for event in events)
114 120
115 results.AddValue( 121 results.AddValue(
116 scalar.ScalarValue(page, ('parse_css_%s' % category), 122 scalar.ScalarValue(page, ('parse_css_%s' % category),
117 'tokens/s', 1000 / (parse_duration / tokens))) 123 'tokens/s', 1000 / (parse_duration / tokens)))
118 124
119 results.AddValue( 125 results.AddValue(
120 scalar.ScalarValue(page, ('tokenize_css_%s' % category), 126 scalar.ScalarValue(page, ('tokenize_css_%s' % category),
121 'char/s', 1000 / (tokenize_duration / length))) 127 'char/s', 1000 / (tokenize_duration / length)))
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/blink_style.py ('k') | tools/perf/measurements/blink_style_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698