| OLD | NEW |
| 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 os | 5 import os |
| 6 | 6 |
| 7 from core import path_util | 7 from core import path_util |
| 8 from core import perf_benchmark | 8 from core import perf_benchmark |
| 9 | 9 |
| 10 from page_sets import webgl_supported_shared_state |
| 11 |
| 10 from telemetry import benchmark | 12 from telemetry import benchmark |
| 11 from telemetry import page as page_module | 13 from telemetry import page as page_module |
| 12 from telemetry.page import legacy_page_test | 14 from telemetry.page import legacy_page_test |
| 13 from telemetry.page import shared_page_state | 15 from telemetry.page import shared_page_state |
| 14 from telemetry import story | 16 from telemetry import story |
| 15 from telemetry.timeline import bounds | 17 from telemetry.timeline import bounds |
| 16 from telemetry.timeline import model as model_module | 18 from telemetry.timeline import model as model_module |
| 17 from telemetry.timeline import tracing_config | 19 from telemetry.timeline import tracing_config |
| 18 | 20 |
| 19 from telemetry.value import list_of_scalar_values | 21 from telemetry.value import list_of_scalar_values |
| 20 from telemetry.value import scalar | |
| 21 from telemetry.value import trace | 22 from telemetry.value import trace |
| 22 | 23 |
| 23 | 24 |
| 24 from measurements import timeline_controller | |
| 25 from page_sets import webgl_supported_shared_state | |
| 26 | |
| 27 | |
| 28 BLINK_PERF_BASE_DIR = os.path.join(path_util.GetChromiumSrcDir(), | 25 BLINK_PERF_BASE_DIR = os.path.join(path_util.GetChromiumSrcDir(), |
| 29 'third_party', 'WebKit', 'PerformanceTests') | 26 'third_party', 'WebKit', 'PerformanceTests') |
| 30 SKIPPED_FILE = os.path.join(BLINK_PERF_BASE_DIR, 'Skipped') | 27 SKIPPED_FILE = os.path.join(BLINK_PERF_BASE_DIR, 'Skipped') |
| 31 | 28 |
| 32 | 29 |
| 33 def CreateStorySetFromPath(path, skipped_file, | 30 def CreateStorySetFromPath(path, skipped_file, |
| 34 shared_page_state_class=( | 31 shared_page_state_class=( |
| 35 shared_page_state.SharedPageState)): | 32 shared_page_state.SharedPageState)): |
| 36 assert os.path.exists(path) | 33 assert os.path.exists(path) |
| 37 | 34 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 232 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 236 results.current_page, metric, units, values)) | 233 results.current_page, metric, units, values)) |
| 237 | 234 |
| 238 break | 235 break |
| 239 | 236 |
| 240 print log | 237 print log |
| 241 | 238 |
| 242 self.PrintAndCollectTraceEventMetrics(trace_cpu_time_metrics, results) | 239 self.PrintAndCollectTraceEventMetrics(trace_cpu_time_metrics, results) |
| 243 | 240 |
| 244 | 241 |
| 245 # TODO(wangxianzhu): Convert the paint benchmarks to use the new blink_perf | |
| 246 # tracing once it's ready. | |
| 247 class _BlinkPerfPaintMeasurement(_BlinkPerfMeasurement): | |
| 248 """Also collects prePaint and paint timing from traces.""" | |
| 249 | |
| 250 def __init__(self): | |
| 251 super(_BlinkPerfPaintMeasurement, self).__init__() | |
| 252 self._controller = None | |
| 253 | |
| 254 def WillNavigateToPage(self, page, tab): | |
| 255 super(_BlinkPerfPaintMeasurement, self).WillNavigateToPage(page, tab) | |
| 256 self._controller = timeline_controller.TimelineController() | |
| 257 self._controller.trace_categories = 'blink,blink.console' | |
| 258 self._controller.SetUp(page, tab) | |
| 259 self._controller.Start(tab) | |
| 260 | |
| 261 def DidRunPage(self, platform): | |
| 262 if self._controller: | |
| 263 self._controller.CleanUp(platform) | |
| 264 | |
| 265 def ValidateAndMeasurePage(self, page, tab, results): | |
| 266 super(_BlinkPerfPaintMeasurement, self).ValidateAndMeasurePage( | |
| 267 page, tab, results) | |
| 268 self._controller.Stop(tab, results) | |
| 269 renderer = self._controller.model.GetRendererThreadFromTabId(tab.id) | |
| 270 # The marker marks the beginning and ending of the measured runs. | |
| 271 marker = next(event for event in renderer.async_slices | |
| 272 if event.name == 'blink_perf' | |
| 273 and event.category == 'blink.console') | |
| 274 assert marker | |
| 275 | |
| 276 for event in renderer.all_slices: | |
| 277 if event.start < marker.start or event.end > marker.end: | |
| 278 continue | |
| 279 if event.name == 'FrameView::prePaint': | |
| 280 results.AddValue( | |
| 281 scalar.ScalarValue(page, 'prePaint', 'ms', event.duration)) | |
| 282 if event.name == 'FrameView::paintTree': | |
| 283 results.AddValue( | |
| 284 scalar.ScalarValue(page, 'paint', 'ms', event.duration)) | |
| 285 | |
| 286 | |
| 287 class _BlinkPerfBenchmark(perf_benchmark.PerfBenchmark): | 242 class _BlinkPerfBenchmark(perf_benchmark.PerfBenchmark): |
| 288 | 243 |
| 289 test = _BlinkPerfMeasurement | 244 test = _BlinkPerfMeasurement |
| 290 | 245 |
| 291 @classmethod | 246 @classmethod |
| 292 def Name(cls): | 247 def Name(cls): |
| 293 return 'blink_perf.' + cls.tag | 248 return 'blink_perf.' + cls.tag |
| 294 | 249 |
| 295 def CreateStorySet(self, options): | 250 def CreateStorySet(self, options): |
| 296 path = os.path.join(BLINK_PERF_BASE_DIR, self.subdir) | 251 path = os.path.join(BLINK_PERF_BASE_DIR, self.subdir) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 tag = 'layout' | 325 tag = 'layout' |
| 371 subdir = 'Layout' | 326 subdir = 'Layout' |
| 372 | 327 |
| 373 @classmethod | 328 @classmethod |
| 374 def ShouldDisable(cls, possible_browser): | 329 def ShouldDisable(cls, possible_browser): |
| 375 return cls.IsSvelte(possible_browser) # http://crbug.com/551950 | 330 return cls.IsSvelte(possible_browser) # http://crbug.com/551950 |
| 376 | 331 |
| 377 | 332 |
| 378 @benchmark.Owner(emails=['wangxianzhu@chromium.org']) | 333 @benchmark.Owner(emails=['wangxianzhu@chromium.org']) |
| 379 class BlinkPerfPaint(_BlinkPerfBenchmark): | 334 class BlinkPerfPaint(_BlinkPerfBenchmark): |
| 380 test = _BlinkPerfPaintMeasurement | |
| 381 tag = 'paint' | 335 tag = 'paint' |
| 382 subdir = 'Paint' | 336 subdir = 'Paint' |
| 383 | 337 |
| 384 @classmethod | 338 @classmethod |
| 385 def ShouldDisable(cls, possible_browser): | 339 def ShouldDisable(cls, possible_browser): |
| 386 return cls.IsSvelte(possible_browser) # http://crbug.com/574483 | 340 return cls.IsSvelte(possible_browser) # http://crbug.com/574483 |
| 387 | 341 |
| 388 | 342 |
| 389 @benchmark.Disabled('win') # crbug.com/488493 | 343 @benchmark.Disabled('win') # crbug.com/488493 |
| 390 @benchmark.Owner(emails=['yukishiino@chromium.org', | 344 @benchmark.Owner(emails=['yukishiino@chromium.org', |
| (...skipping 11 matching lines...) Expand all Loading... |
| 402 | 356 |
| 403 | 357 |
| 404 @benchmark.Owner(emails=['hayato@chromium.org']) | 358 @benchmark.Owner(emails=['hayato@chromium.org']) |
| 405 class BlinkPerfShadowDOM(_BlinkPerfBenchmark): | 359 class BlinkPerfShadowDOM(_BlinkPerfBenchmark): |
| 406 tag = 'shadow_dom' | 360 tag = 'shadow_dom' |
| 407 subdir = 'ShadowDOM' | 361 subdir = 'ShadowDOM' |
| 408 | 362 |
| 409 @classmethod | 363 @classmethod |
| 410 def ShouldDisable(cls, possible_browser): # http://crbug.com/702319 | 364 def ShouldDisable(cls, possible_browser): # http://crbug.com/702319 |
| 411 return possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X' | 365 return possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X' |
| OLD | NEW |