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

Side by Side Diff: tools/perf/benchmarks/service_worker.py

Issue 1917393002: [tools/perf] Reference legacy_page_test module instead of page_test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/robohornet_pro.py ('k') | tools/perf/benchmarks/spaceport.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 collections 5 import collections
6 import page_sets 6 import page_sets
7 import re 7 import re
8 8
9 from core import perf_benchmark 9 from core import perf_benchmark
10 10
11 from telemetry.core import util 11 from telemetry.core import util
12 from telemetry.page import page_test 12 from telemetry.page import legacy_page_test
13 from telemetry.timeline import async_slice as async_slice_module 13 from telemetry.timeline import async_slice as async_slice_module
14 from telemetry.timeline import slice as slice_module 14 from telemetry.timeline import slice as slice_module
15 from telemetry.value import scalar 15 from telemetry.value import scalar
16 16
17 from measurements import timeline_controller 17 from measurements import timeline_controller
18 from metrics import speedindex 18 from metrics import speedindex
19 19
20 20
21 class _ServiceWorkerTimelineMetric(object): 21 class _ServiceWorkerTimelineMetric(object):
22 22
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 full_name = thread_name + '|' + sanitized_event_name 79 full_name = thread_name + '|' + sanitized_event_name
80 results.AddValue(scalar.ScalarValue( 80 results.AddValue(scalar.ScalarValue(
81 results.current_page, full_name, 'ms', total)) 81 results.current_page, full_name, 'ms', total))
82 results.AddValue(scalar.ScalarValue( 82 results.AddValue(scalar.ScalarValue(
83 results.current_page, full_name + '_max', 'ms', biggest_jank)) 83 results.current_page, full_name + '_max', 'ms', biggest_jank))
84 results.AddValue(scalar.ScalarValue( 84 results.AddValue(scalar.ScalarValue(
85 results.current_page, full_name + '_avg', 'ms', total / len(times))) 85 results.current_page, full_name + '_avg', 'ms', total / len(times)))
86 86
87 87
88 class _ServiceWorkerMeasurement(page_test.PageTest): 88 class _ServiceWorkerMeasurement(legacy_page_test.LegacyPageTest):
89 """Measure Speed Index and TRACE_EVENTs""" 89 """Measure Speed Index and TRACE_EVENTs"""
90 90
91 def __init__(self): 91 def __init__(self):
92 super(_ServiceWorkerMeasurement, self).__init__() 92 super(_ServiceWorkerMeasurement, self).__init__()
93 self._timeline_controller = timeline_controller.TimelineController() 93 self._timeline_controller = timeline_controller.TimelineController()
94 self._speed_index = speedindex.SpeedIndexMetric() 94 self._speed_index = speedindex.SpeedIndexMetric()
95 self._page_open_times = collections.defaultdict(int) 95 self._page_open_times = collections.defaultdict(int)
96 96
97 def DidRunPage(self, platform): 97 def DidRunPage(self, platform):
98 if platform.tracing_controller.is_tracing_running: 98 if platform.tracing_controller.is_tracing_running:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 self._page_open_times[url] += 1 135 self._page_open_times[url] += 1
136 if self._page_open_times[url] == 1: 136 if self._page_open_times[url] == 1:
137 chart_prefix += '_1st' 137 chart_prefix += '_1st'
138 elif self._page_open_times[url] == 2: 138 elif self._page_open_times[url] == 2:
139 chart_prefix += '_2nd' 139 chart_prefix += '_2nd'
140 else: 140 else:
141 chart_prefix += '_later' 141 chart_prefix += '_later'
142 self._speed_index.AddResults(tab, results, chart_prefix) 142 self._speed_index.AddResults(tab, results, chart_prefix)
143 143
144 144
145 class _ServiceWorkerMicroBenchmarkMeasurement(page_test.PageTest): 145 class _ServiceWorkerMicroBenchmarkMeasurement(legacy_page_test.LegacyPageTest):
146 """Record results reported by the JS microbenchmark.""" 146 """Record results reported by the JS microbenchmark."""
147 147
148 def __init__(self): 148 def __init__(self):
149 super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__() 149 super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__()
150 150
151 def ValidateAndMeasurePage(self, page, tab, results): 151 def ValidateAndMeasurePage(self, page, tab, results):
152 tab.WaitForJavaScriptExpression('window.done', 40) 152 tab.WaitForJavaScriptExpression('window.done', 40)
153 json = tab.EvaluateJavaScript('window.results || {}') 153 json = tab.EvaluateJavaScript('window.results || {}')
154 for key, value in json.iteritems(): 154 for key, value in json.iteritems():
155 results.AddValue(scalar.ScalarValue( 155 results.AddValue(scalar.ScalarValue(
(...skipping 27 matching lines...) Expand all
183 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet 183 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet
184 184
185 @classmethod 185 @classmethod
186 def Name(cls): 186 def Name(cls):
187 return 'service_worker.service_worker_micro_benchmark' 187 return 'service_worker.service_worker_micro_benchmark'
188 188
189 @classmethod 189 @classmethod
190 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 190 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656
191 return (possible_browser.browser_type == 'reference' and 191 return (possible_browser.browser_type == 'reference' and
192 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') 192 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X')
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/robohornet_pro.py ('k') | tools/perf/benchmarks/spaceport.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698