| Index: tools/perf/measurements/smoothness_controller.py
|
| diff --git a/tools/perf/measurements/smoothness_controller.py b/tools/perf/measurements/smoothness_controller.py
|
| index b5efc33a1b03aa600d4d213ff9504810fb0e4f9a..f39b92b346f3e0f699c7324c64ab6e970c1693ea 100644
|
| --- a/tools/perf/measurements/smoothness_controller.py
|
| +++ b/tools/perf/measurements/smoothness_controller.py
|
| @@ -18,13 +18,23 @@
|
|
|
| RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions'
|
|
|
| +# Descriptions for results from platform.GetRawDisplayFrameRateMeasurements().
|
| +DESCRIPTIONS = {
|
| + 'avg_surface_fps': 'Average frames per second as measured by the '
|
| + 'platform\'s SurfaceFlinger.'
|
| +}
|
| +
|
| +
|
| +class MissingDisplayFrameRateError(page_test.MeasurementFailure):
|
| + def __init__(self, name):
|
| + super(MissingDisplayFrameRateError, self).__init__(
|
| + 'Missing display frame rate metrics: ' + name)
|
|
|
| class SmoothnessController(object):
|
| def __init__(self):
|
| self._timeline_model = None
|
| self._tracing_timeline_data = None
|
| self._interaction = None
|
| - self._surface_flinger_timeline_data = None
|
|
|
| def SetUp(self, page, tab):
|
| # FIXME: Remove webkit.console when blink.console lands in chromium and
|
| @@ -37,8 +47,8 @@
|
| options = tracing_options.TracingOptions()
|
| options.enable_chrome_trace = True
|
| tab.browser.platform.tracing_controller.Start(options, category_filter, 60)
|
| - if tab.browser.platform.IsDisplayTracingSupported():
|
| - tab.browser.platform.StartDisplayTracing();
|
| + if tab.browser.platform.IsRawDisplayFrameRateSupported():
|
| + tab.browser.platform.StartRawDisplayFrameRateMeasurement()
|
|
|
| def Start(self, tab):
|
| # Start the smooth marker for all smooth actions.
|
| @@ -50,15 +60,11 @@
|
| # End the smooth marker for all smooth actions.
|
| self._interaction.End()
|
| # Stop tracing for smoothness metric.
|
| - if tab.browser.platform.IsDisplayTracingSupported():
|
| - self._surface_flinger_timeline_data = \
|
| - tab.browser.platform.StopDisplayTracing()
|
| + if tab.browser.platform.IsRawDisplayFrameRateSupported():
|
| + tab.browser.platform.StopRawDisplayFrameRateMeasurement()
|
| self._tracing_timeline_data = tab.browser.platform.tracing_controller.Stop()
|
| - timeline_data = [self._tracing_timeline_data]
|
| - if self._surface_flinger_timeline_data:
|
| - timeline_data.append(self._surface_flinger_timeline_data)
|
| self._timeline_model = TimelineModel(
|
| - timeline_data=timeline_data)
|
| + timeline_data=self._tracing_timeline_data)
|
|
|
| def AddResults(self, tab, results):
|
| # Add results of smoothness metric. This computes the smoothness metric for
|
| @@ -103,10 +109,22 @@
|
| # not be used.
|
| smoothness_metric = smoothness.SmoothnessMetric()
|
| smoothness_metric.AddResults(
|
| - self._timeline_model, renderer_thread, smooth_records, results)
|
| + self._timeline_model, renderer_thread, smooth_records, results)
|
| + if tab.browser.platform.IsRawDisplayFrameRateSupported():
|
| + for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
|
| + if r.value is None:
|
| + raise MissingDisplayFrameRateError(r.name)
|
| + if isinstance(r.value, list):
|
| + results.AddValue(list_of_scalar_values.ListOfScalarValues(
|
| + results.current_page, r.name, r.unit, r.value,
|
| + description=DESCRIPTIONS.get(r.name)))
|
| + else:
|
| + results.AddValue(scalar.ScalarValue(
|
| + results.current_page, r.name, r.unit, r.value,
|
| + description=DESCRIPTIONS.get(r.name)))
|
|
|
| def CleanUp(self, tab):
|
| - if tab.browser.platform.IsDisplayTracingSupported():
|
| - tab.browser.platform.StopDisplayTracing()
|
| + if tab.browser.platform.IsRawDisplayFrameRateSupported():
|
| + tab.browser.platform.StopRawDisplayFrameRateMeasurement()
|
| if tab.browser.platform.tracing_controller.is_tracing_running:
|
| tab.browser.platform.tracing_controller.Stop()
|
|
|