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