| 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 sys | 4 import sys |
| 5 | 5 |
| 6 from measurements import smooth_gesture_util | 6 from measurements import smooth_gesture_util |
| 7 from telemetry.timeline.model import TimelineModel | 7 from telemetry.timeline.model import TimelineModel |
| 8 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
| 9 from telemetry.page.actions import action_runner | 9 from telemetry.page.actions import action_runner |
| 10 from telemetry.web_perf import timeline_interaction_record as tir_module | 10 from telemetry.web_perf import timeline_interaction_record as tir_module |
| 11 from telemetry.web_perf.metrics import smoothness | 11 from telemetry.web_perf.metrics import smoothness |
| 12 from telemetry.value import scalar | |
| 13 | 12 |
| 14 | 13 |
| 15 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' | 14 RUN_SMOOTH_ACTIONS = 'RunSmoothAllActions' |
| 16 | 15 |
| 17 | 16 |
| 18 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): | 17 class MissingDisplayFrameRateError(page_measurement.MeasurementFailure): |
| 19 def __init__(self, name): | 18 def __init__(self, name): |
| 20 super(MissingDisplayFrameRateError, self).__init__( | 19 super(MissingDisplayFrameRateError, self).__init__( |
| 21 'Missing display frame rate metrics: ' + name) | 20 'Missing display frame rate metrics: ' + name) |
| 22 | 21 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 # Create an interaction_record for this legacy measurement. Since we don't | 88 # Create an interaction_record for this legacy measurement. Since we don't |
| 90 # wrap the results that is sent to smoothnes metric, the logical_name will | 89 # wrap the results that is sent to smoothnes metric, the logical_name will |
| 91 # not be used. | 90 # not be used. |
| 92 smoothness_metric = smoothness.SmoothnessMetric() | 91 smoothness_metric = smoothness.SmoothnessMetric() |
| 93 smoothness_metric.AddResults( | 92 smoothness_metric.AddResults( |
| 94 self._timeline_model, renderer_thread, smooth_records, results) | 93 self._timeline_model, renderer_thread, smooth_records, results) |
| 95 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 94 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 96 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 95 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
| 97 if r.value is None: | 96 if r.value is None: |
| 98 raise MissingDisplayFrameRateError(r.name) | 97 raise MissingDisplayFrameRateError(r.name) |
| 99 results.AddValue(scalar.ScalarValue( | 98 results.Add(r.name, r.unit, r.value) |
| 100 results.current_page, r.name, r.unit, r.value)) | |
| 101 | 99 |
| 102 def CleanUp(self, tab): | 100 def CleanUp(self, tab): |
| 103 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 101 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 104 tab.browser.platform.StopRawDisplayFrameRateMeasurement() | 102 tab.browser.platform.StopRawDisplayFrameRateMeasurement() |
| 105 if tab.browser.is_tracing_running: | 103 if tab.browser.is_tracing_running: |
| 106 tab.browser.StopTracing() | 104 tab.browser.StopTracing() |
| OLD | NEW |