OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 | 4 |
5 from metrics import Metric | 5 from metrics import Metric |
6 from metrics import rendering_stats | 6 from metrics import rendering_stats |
7 from metrics import statistics | 7 from metrics import statistics |
8 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
9 from telemetry.page.perf_tests_helper import FlattenList | 9 from telemetry.page.perf_tests_helper import FlattenList |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 results.Add('mean_mouse_wheel_scroll_latency', 'ms', | 85 results.Add('mean_mouse_wheel_scroll_latency', 'ms', |
86 round(mean_mouse_wheel_scroll_latency, 3)) | 86 round(mean_mouse_wheel_scroll_latency, 3)) |
87 | 87 |
88 if self._stats.touch_scroll_latency: | 88 if self._stats.touch_scroll_latency: |
89 mean_touch_scroll_latency = statistics.ArithmeticMean( | 89 mean_touch_scroll_latency = statistics.ArithmeticMean( |
90 self._stats.touch_scroll_latency, | 90 self._stats.touch_scroll_latency, |
91 len(self._stats.touch_scroll_latency)) | 91 len(self._stats.touch_scroll_latency)) |
92 results.Add('mean_touch_scroll_latency', 'ms', | 92 results.Add('mean_touch_scroll_latency', 'ms', |
93 round(mean_touch_scroll_latency, 3)) | 93 round(mean_touch_scroll_latency, 3)) |
94 | 94 |
| 95 if self._stats.js_touch_scroll_latency: |
| 96 mean_js_touch_scroll_latency = statistics.ArithmeticMean( |
| 97 self._stats.js_touch_scroll_latency, |
| 98 len(self._stats.js_touch_scroll_latency)) |
| 99 results.Add('mean_js_touch_scroll_latency', 'ms', |
| 100 round(mean_js_touch_scroll_latency, 3)) |
| 101 |
95 # List of raw frame times. | 102 # List of raw frame times. |
96 frame_times = FlattenList(self._stats.frame_times) | 103 frame_times = FlattenList(self._stats.frame_times) |
97 results.Add('frame_times', 'ms', frame_times) | 104 results.Add('frame_times', 'ms', frame_times) |
98 | 105 |
99 # Arithmetic mean of frame times. | 106 # Arithmetic mean of frame times. |
100 mean_frame_time = statistics.ArithmeticMean(frame_times, | 107 mean_frame_time = statistics.ArithmeticMean(frame_times, |
101 len(frame_times)) | 108 len(frame_times)) |
102 results.Add('mean_frame_time', 'ms', round(mean_frame_time, 3)) | 109 results.Add('mean_frame_time', 'ms', round(mean_frame_time, 3)) |
103 | 110 |
104 # Absolute discrepancy of frame time stamps. | 111 # Absolute discrepancy of frame time stamps. |
105 jank = statistics.FrameDiscrepancy(self._stats.frame_timestamps) | 112 jank = statistics.FrameDiscrepancy(self._stats.frame_timestamps) |
106 results.Add('jank', '', round(jank, 4)) | 113 results.Add('jank', '', round(jank, 4)) |
107 | 114 |
108 # Are we hitting 60 fps for 95 percent of all frames? | 115 # Are we hitting 60 fps for 95 percent of all frames? |
109 # We use 19ms as a somewhat looser threshold, instead of 1000.0/60.0. | 116 # We use 19ms as a somewhat looser threshold, instead of 1000.0/60.0. |
110 percentile_95 = statistics.Percentile(frame_times, 95.0) | 117 percentile_95 = statistics.Percentile(frame_times, 95.0) |
111 results.Add('mostly_smooth', 'score', 1.0 if percentile_95 < 19.0 else 0.0) | 118 results.Add('mostly_smooth', 'score', 1.0 if percentile_95 < 19.0 else 0.0) |
112 | 119 |
113 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 120 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
114 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 121 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
115 if r.value is None: | 122 if r.value is None: |
116 raise MissingDisplayFrameRateError(r.name) | 123 raise MissingDisplayFrameRateError(r.name) |
117 results.Add(r.name, r.unit, r.value) | 124 results.Add(r.name, r.unit, r.value) |
OLD | NEW |