| OLD | NEW |
| 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 import os | 4 import os |
| 5 import re | |
| 6 | 5 |
| 7 from core import path_util | 6 from core import path_util |
| 8 from core import perf_benchmark | 7 from core import perf_benchmark |
| 9 from page_sets import google_pages | 8 from page_sets import google_pages |
| 10 | 9 |
| 11 from benchmarks import v8_helper | 10 from benchmarks import v8_helper |
| 12 | 11 |
| 13 from measurements import v8_detached_context_age_in_gc | 12 from measurements import v8_detached_context_age_in_gc |
| 14 from measurements import v8_gc_times | 13 from measurements import v8_gc_times |
| 15 import page_sets | 14 import page_sets |
| 16 from telemetry import benchmark | 15 from telemetry import benchmark |
| 17 from telemetry import story | 16 from telemetry import story |
| 18 from telemetry.timeline import chrome_trace_config | |
| 19 from telemetry.timeline import chrome_trace_category_filter | 17 from telemetry.timeline import chrome_trace_category_filter |
| 20 from telemetry.web_perf import timeline_based_measurement | 18 from telemetry.web_perf import timeline_based_measurement |
| 21 | 19 |
| 22 | 20 |
| 23 def CreateV8TimelineBasedMeasurementOptions(): | 21 def CreateV8TimelineBasedMeasurementOptions(): |
| 24 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() | 22 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() |
| 25 category_filter.AddIncludedCategory('v8') | 23 category_filter.AddIncludedCategory('v8') |
| 26 category_filter.AddIncludedCategory('blink.console') | 24 category_filter.AddIncludedCategory('blink.console') |
| 27 category_filter.AddDisabledByDefault('disabled-by-default-v8.compile') | 25 category_filter.AddDisabledByDefault('disabled-by-default-v8.compile') |
| 28 options = timeline_based_measurement.Options(category_filter) | 26 options = timeline_based_measurement.Options(category_filter) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 @classmethod | 189 @classmethod |
| 192 def Name(cls): | 190 def Name(cls): |
| 193 return 'v8.mobile_infinite_scroll_tbmv2' | 191 return 'v8.mobile_infinite_scroll_tbmv2' |
| 194 | 192 |
| 195 @classmethod | 193 @classmethod |
| 196 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 | 194 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 |
| 197 return (possible_browser.browser_type == 'reference' and | 195 return (possible_browser.browser_type == 'reference' and |
| 198 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') | 196 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') |
| 199 | 197 |
| 200 | 198 |
| 201 class _V8MemoryAndCodeSizeBenchmark(perf_benchmark.PerfBenchmark): | |
| 202 """Base class for benchmarks measuring code size.""" | |
| 203 | |
| 204 _IGNORED_V8_STATS_RE = re.compile( | |
| 205 r'(?<!dump)(?<!process)_(std|count|min|sum|pct_\d{4}(_\d+)?)$') | |
| 206 | |
| 207 def CreateTimelineBasedMeasurementOptions(self): | |
| 208 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter( | |
| 209 '-*, disabled-by-default-memory-infra,' | |
| 210 # TODO(crbug.com/616441, primiano): Remove this temporary workaround, | |
| 211 # which enables memory-infra V8 code stats in V8 code size benchmarks | |
| 212 # only (to not slow down detailed memory dumps in other benchmarks). | |
| 213 'disabled-by-default-memory-infra.v8.code_stats') | |
| 214 options = timeline_based_measurement.Options(category_filter) | |
| 215 # Trigger periodic light memory dumps every 20 ms. | |
| 216 memory_dump_config = chrome_trace_config.MemoryDumpConfig() | |
| 217 memory_dump_config.AddTrigger('light', 20) | |
| 218 options.config.chrome_trace_config.SetMemoryDumpConfig(memory_dump_config) | |
| 219 options.SetTimelineBasedMetrics(['memoryMetric']) | |
| 220 return options | |
| 221 | |
| 222 page_set = page_sets.Top10MobileMemoryPageSet | |
| 223 | |
| 224 @classmethod | |
| 225 def ShouldTearDownStateAfterEachStoryRun(cls): | |
| 226 return True | |
| 227 | |
| 228 @classmethod | |
| 229 def ValueCanBeAddedPredicate(cls, value, is_first_result): | |
| 230 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard | |
| 231 # is able to cope with the data load generated by TBMv2 metrics. | |
| 232 if 'memory' not in value.name: | |
| 233 return True # Keep all non-memory values. | |
| 234 # TODO(petrcermak): Remove the 'subsystem' disjunct once | |
| 235 # https://codereview.chromium.org/2018503002/ lands in Catapult and rolls | |
| 236 # into Chromium. | |
| 237 if (('subsystem' in value.name or 'reported_by_chrome' in value.name) and | |
| 238 'v8' not in value.name): | |
| 239 return False # Drop non-V8 values reported by Chrome. | |
| 240 # Keep dump counts and average+max of process counts, vmstats and v8. | |
| 241 return not cls._IGNORED_V8_STATS_RE.search(value.name) | |
| 242 | |
| 243 | |
| 244 @benchmark.Enabled('android') | |
| 245 class V8MobileCodeSizeIgnition(_V8MemoryAndCodeSizeBenchmark): | |
| 246 """Measures V8 heap and code size with ignition enabled on mobile web pages. | |
| 247 | |
| 248 http://www.chromium.org/developers/design-documents/rendering-benchmarks | |
| 249 """ | |
| 250 | |
| 251 def SetExtraBrowserOptions(self, options): | |
| 252 super(V8MobileCodeSizeIgnition, self).SetExtraBrowserOptions(options) | |
| 253 v8_helper.EnableIgnition(options) | |
| 254 | |
| 255 # crbug.com/639007 | |
| 256 @classmethod | |
| 257 def ShouldDisable(cls, possible_browser): | |
| 258 if (possible_browser.browser_type == 'reference' and | |
| 259 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): | |
| 260 return True | |
| 261 | |
| 262 @classmethod | |
| 263 def Name(cls): | |
| 264 return 'top_10_mobile_memory_ignition' | |
| 265 | |
| 266 | |
| 267 @benchmark.Enabled('android') | |
| 268 class V8MobileCodeSize(_V8MemoryAndCodeSizeBenchmark): | |
| 269 """Measures V8 heap and code size on mobile web pages. | |
| 270 | |
| 271 http://www.chromium.org/developers/design-documents/rendering-benchmarks | |
| 272 """ | |
| 273 | |
| 274 # crbug.com/639007 | |
| 275 @classmethod | |
| 276 def ShouldDisable(cls, possible_browser): | |
| 277 if (possible_browser.browser_type == 'reference' and | |
| 278 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X'): | |
| 279 return True | |
| 280 | |
| 281 @classmethod | |
| 282 def Name(cls): | |
| 283 return 'top_10_mobile_memory' | |
| 284 | |
| 285 | |
| 286 class V8Adword(perf_benchmark.PerfBenchmark): | 199 class V8Adword(perf_benchmark.PerfBenchmark): |
| 287 """Measures V8 Execution metrics on the Adword page.""" | 200 """Measures V8 Execution metrics on the Adword page.""" |
| 288 | 201 |
| 289 options = {'pageset_repeat': 3} | 202 options = {'pageset_repeat': 3} |
| 290 | 203 |
| 291 def CreateTimelineBasedMeasurementOptions(self): | 204 def CreateTimelineBasedMeasurementOptions(self): |
| 292 return CreateV8TimelineBasedMeasurementOptions() | 205 return CreateV8TimelineBasedMeasurementOptions() |
| 293 | 206 |
| 294 def CreateStorySet(self, options): | 207 def CreateStorySet(self, options): |
| 295 """Creates the instance of StorySet used to run the benchmark. | 208 """Creates the instance of StorySet used to run the benchmark. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 313 return True | 226 return True |
| 314 # http://crbug.com/623576 | 227 # http://crbug.com/623576 |
| 315 if (possible_browser.platform.GetDeviceTypeName() == 'Nexus 5' or | 228 if (possible_browser.platform.GetDeviceTypeName() == 'Nexus 5' or |
| 316 possible_browser.platform.GetDeviceTypeName() == 'Nexus 7'): | 229 possible_browser.platform.GetDeviceTypeName() == 'Nexus 7'): |
| 317 return True | 230 return True |
| 318 return False | 231 return False |
| 319 | 232 |
| 320 @classmethod | 233 @classmethod |
| 321 def ShouldTearDownStateAfterEachStoryRun(cls): | 234 def ShouldTearDownStateAfterEachStoryRun(cls): |
| 322 return True | 235 return True |
| OLD | NEW |