Commit 52272d9c authored by dominikg@chromium.org's avatar dominikg@chromium.org

Telemetry: Initialize smoothness and thread_times metrics before page load, not after.

Currently both smoothness and thread_times initialize their metrics after page
load. This leads to a gap between the page load and the page actions starting.
This patch moves the initialization before the page load, thus eliminating the
gap. It is safe to do so because smoothness and thread_times require a page load
before each run (even when repeating the same page).

Note to perf sheriffs:
This patch is likely to cause performance numbers to worsen, because the browser is often more busy immediately after page load. If you get alerts related to this CL, feel free to ignore them. If there is a reference build for the bot, the number for the reference build should also change accordingly.

BUG=392895

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285297

Review URL: https://codereview.chromium.org/392613002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285616 0039d316-1c4b-4281-b951-d872f2087c98
parent 06530cd9
...@@ -13,7 +13,8 @@ class LoadingTrace(page_measurement.PageMeasurement): ...@@ -13,7 +13,8 @@ class LoadingTrace(page_measurement.PageMeasurement):
self._timeline_controller = timeline_controller.TimelineController() self._timeline_controller = timeline_controller.TimelineController()
def WillNavigateToPage(self, page, tab): def WillNavigateToPage(self, page, tab):
self._timeline_controller.Start(page, tab) self._timeline_controller.SetUp(page, tab)
self._timeline_controller.Start(tab)
def MeasurePage(self, page, tab, results): def MeasurePage(self, page, tab, results):
# In current telemetry tests, all tests wait for DocumentComplete state, # In current telemetry tests, all tests wait for DocumentComplete state,
......
...@@ -35,7 +35,8 @@ class Repaint(page_measurement.PageMeasurement): ...@@ -35,7 +35,8 @@ class Repaint(page_measurement.PageMeasurement):
def WillRunActions(self, page, tab): def WillRunActions(self, page, tab):
tab.WaitForDocumentReadyStateToBeComplete() tab.WaitForDocumentReadyStateToBeComplete()
self._smoothness_controller = smoothness_controller.SmoothnessController() self._smoothness_controller = smoothness_controller.SmoothnessController()
self._smoothness_controller.Start(page, tab) self._smoothness_controller.SetUp(page, tab)
self._smoothness_controller.Start(tab)
# Rasterize only what's visible. # Rasterize only what's visible.
tab.ExecuteJavaScript( tab.ExecuteJavaScript(
'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();')
......
...@@ -22,10 +22,13 @@ class Smoothness(page_measurement.PageMeasurement): ...@@ -22,10 +22,13 @@ class Smoothness(page_measurement.PageMeasurement):
def WillStartBrowser(self, browser): def WillStartBrowser(self, browser):
self._power_metric = power.PowerMetric(browser) self._power_metric = power.PowerMetric(browser)
def WillRunActions(self, page, tab): def WillNavigateToPage(self, page, tab):
self._power_metric.Start(page, tab) self._power_metric.Start(page, tab)
self._smoothness_controller = smoothness_controller.SmoothnessController() self._smoothness_controller = smoothness_controller.SmoothnessController()
self._smoothness_controller.Start(page, tab) self._smoothness_controller.SetUp(page, tab)
def WillRunActions(self, page, tab):
self._smoothness_controller.Start(tab)
def DidRunActions(self, page, tab): def DidRunActions(self, page, tab):
self._power_metric.Stop(page, tab) self._power_metric.Stop(page, tab)
......
...@@ -27,7 +27,7 @@ class SmoothnessController(object): ...@@ -27,7 +27,7 @@ class SmoothnessController(object):
self._tracing_timeline_data = None self._tracing_timeline_data = None
self._interaction = None self._interaction = None
def Start(self, page, tab): def SetUp(self, page, tab):
# FIXME: Remove webkit.console when blink.console lands in chromium and # FIXME: Remove webkit.console when blink.console lands in chromium and
# the ref builds are updated. crbug.com/386847 # the ref builds are updated. crbug.com/386847
custom_categories = ['webkit.console', 'blink.console', 'benchmark'] custom_categories = ['webkit.console', 'blink.console', 'benchmark']
...@@ -35,6 +35,8 @@ class SmoothnessController(object): ...@@ -35,6 +35,8 @@ class SmoothnessController(object):
tab.browser.StartTracing(','.join(custom_categories), 60) tab.browser.StartTracing(','.join(custom_categories), 60)
if tab.browser.platform.IsRawDisplayFrameRateSupported(): if tab.browser.platform.IsRawDisplayFrameRateSupported():
tab.browser.platform.StartRawDisplayFrameRateMeasurement() tab.browser.platform.StartRawDisplayFrameRateMeasurement()
def Start(self, tab):
# Start the smooth marker for all smooth actions. # Start the smooth marker for all smooth actions.
runner = action_runner.ActionRunner(tab) runner = action_runner.ActionRunner(tab)
self._interaction = runner.BeginInteraction( self._interaction = runner.BeginInteraction(
......
...@@ -64,6 +64,7 @@ class SmoothnessUnitTest( ...@@ -64,6 +64,7 @@ class SmoothnessUnitTest(
tab = FakeTab() tab = FakeTab()
measurement = smoothness.Smoothness() measurement = smoothness.Smoothness()
measurement.WillStartBrowser(tab.browser) measurement.WillStartBrowser(tab.browser)
measurement.WillNavigateToPage(test_page, tab)
measurement.WillRunActions(test_page, tab) measurement.WillRunActions(test_page, tab)
expected_category_filter = [ expected_category_filter = [
......
...@@ -18,7 +18,7 @@ class ThreadTimes(page_measurement.PageMeasurement): ...@@ -18,7 +18,7 @@ class ThreadTimes(page_measurement.PageMeasurement):
parser.add_option('--report-silk-details', action='store_true', parser.add_option('--report-silk-details', action='store_true',
help='Report details relevant to silk.') help='Report details relevant to silk.')
def WillRunActions(self, page, tab): def WillNavigateToPage(self, page, tab):
self._timeline_controller = timeline_controller.TimelineController() self._timeline_controller = timeline_controller.TimelineController()
if self.options.report_silk_details: if self.options.report_silk_details:
# We need the other traces in order to have any details to report. # We need the other traces in order to have any details to report.
...@@ -27,7 +27,10 @@ class ThreadTimes(page_measurement.PageMeasurement): ...@@ -27,7 +27,10 @@ class ThreadTimes(page_measurement.PageMeasurement):
else: else:
self._timeline_controller.trace_categories = \ self._timeline_controller.trace_categories = \
tracing_backend.MINIMAL_TRACE_CATEGORIES tracing_backend.MINIMAL_TRACE_CATEGORIES
self._timeline_controller.Start(page, tab) self._timeline_controller.SetUp(page, tab)
def WillRunActions(self, page, tab):
self._timeline_controller.Start(tab)
def DidRunActions(self, page, tab): def DidRunActions(self, page, tab):
self._timeline_controller.Stop(tab) self._timeline_controller.Stop(tab)
......
...@@ -21,7 +21,7 @@ class TimelineController(object): ...@@ -21,7 +21,7 @@ class TimelineController(object):
self._smooth_records = [] self._smooth_records = []
self._interaction = None self._interaction = None
def Start(self, page, tab): def SetUp(self, page, tab):
"""Starts gathering timeline data. """Starts gathering timeline data.
""" """
...@@ -36,6 +36,8 @@ class TimelineController(object): ...@@ -36,6 +36,8 @@ class TimelineController(object):
else: else:
categories = page.GetSyntheticDelayCategories() categories = page.GetSyntheticDelayCategories()
tab.browser.StartTracing(','.join(categories)) tab.browser.StartTracing(','.join(categories))
def Start(self, tab):
# Start the smooth marker for all actions. # Start the smooth marker for all actions.
runner = action_runner.ActionRunner(tab) runner = action_runner.ActionRunner(tab)
self._interaction = runner.BeginInteraction( self._interaction = runner.BeginInteraction(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment