| Index: tools/perf/measurements/smoothness_controller.py
|
| diff --git a/tools/perf/measurements/smoothness_controller.py b/tools/perf/measurements/smoothness_controller.py
|
| index b29a1edda5c75953925564a8640737a20515c65e..d35624b742a74550a78b700706ac8b20812ad0d3 100644
|
| --- a/tools/perf/measurements/smoothness_controller.py
|
| +++ b/tools/perf/measurements/smoothness_controller.py
|
| @@ -4,7 +4,7 @@
|
| import sys
|
|
|
| from measurements import smooth_gesture_util
|
| -from telemetry.timeline.model import TimelineModel
|
| +from telemetry.timeline import model
|
| from telemetry.page import page_measurement
|
| from telemetry.page.actions import action_runner
|
| from telemetry.value import list_of_scalar_values
|
| @@ -55,7 +55,7 @@ class SmoothnessController(object):
|
| if tab.browser.platform.IsRawDisplayFrameRateSupported():
|
| tab.browser.platform.StopRawDisplayFrameRateMeasurement()
|
| self._tracing_timeline_data = tab.browser.StopTracing()
|
| - self._timeline_model = TimelineModel(
|
| + self._timeline_model = model.TimelineModel(
|
| timeline_data=self._tracing_timeline_data)
|
|
|
| def AddResults(self, tab, results):
|
| @@ -63,23 +63,24 @@ class SmoothnessController(object):
|
| # the time ranges of gestures, if there is at least one, else the the time
|
| # ranges from the first action to the last action.
|
|
|
| - renderer_thread = self._timeline_model.GetRendererThreadFromTabId(
|
| - tab.id)
|
| + threads_to_records_map = (
|
| + tir_module.GetThreadToInteractionRecordsMapsFromModel(
|
| + self._timeline_model))
|
| + assert len(threads_to_records_map) == 1, (
|
| + 'Smoothness test only support records issued from single thread')
|
| + interaction_records = threads_to_records_map.values()[0]
|
| run_smooth_actions_record = None
|
| smooth_records = []
|
| - for event in renderer_thread.async_slices:
|
| - if not tir_module.IsTimelineInteractionRecord(event.name):
|
| - continue
|
| - r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event)
|
| + for r in interaction_records:
|
| if r.label == RUN_SMOOTH_ACTIONS:
|
| assert run_smooth_actions_record is None, (
|
| - 'SmoothnessController cannot issue more than 1 %s record' %
|
| - RUN_SMOOTH_ACTIONS)
|
| + 'SmoothnessController cannot issue more than 1 %s record' %
|
| + RUN_SMOOTH_ACTIONS)
|
| run_smooth_actions_record = r
|
| elif r.is_smooth:
|
| smooth_records.append(
|
| - smooth_gesture_util.GetAdjustedInteractionIfContainGesture(
|
| - self._timeline_model, r))
|
| + smooth_gesture_util.GetAdjustedInteractionIfContainGesture(
|
| + self._timeline_model, r))
|
|
|
| # If there is no other smooth records, we make measurements on time range
|
| # marked smoothness_controller itself.
|
| @@ -100,7 +101,7 @@ class SmoothnessController(object):
|
| # not be used.
|
| smoothness_metric = smoothness.SmoothnessMetric()
|
| smoothness_metric.AddResults(
|
| - self._timeline_model, renderer_thread, smooth_records, results)
|
| + self._timeline_model, smooth_records, results)
|
| if tab.browser.platform.IsRawDisplayFrameRateSupported():
|
| for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements():
|
| if r.value is None:
|
|
|