| 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 import collections | 5 import collections |
| 6 | 6 |
| 7 from metrics import Metric | 7 from metrics import Metric |
| 8 from telemetry.core import bitmap | 8 from telemetry.core import bitmap |
| 9 from telemetry.value import scalar | 9 from telemetry.value import scalar |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 'smaller than the load time. On the other hand, If the ' | 62 'smaller than the load time. On the other hand, If the ' |
| 63 'contents are composed by many XHR requests with small ' | 63 'contents are composed by many XHR requests with small ' |
| 64 'main resource and javascript, speed index will be able to ' | 64 'main resource and javascript, speed index will be able to ' |
| 65 'get the features of performance more accurately than load ' | 65 'get the features of performance more accurately than load ' |
| 66 'time because the load time will measure the time when ' | 66 'time because the load time will measure the time when ' |
| 67 'static resources are loaded. If you want to get more ' | 67 'static resources are loaded. If you want to get more ' |
| 68 'detail, please refer to http://goo.gl/Rw3d5d. Currently ' | 68 'detail, please refer to http://goo.gl/Rw3d5d. Currently ' |
| 69 'there are two implementations: for Android and for ' | 69 'there are two implementations: for Android and for ' |
| 70 'Desktop. The Android version uses video capture; the ' | 70 'Desktop. The Android version uses video capture; the ' |
| 71 'Desktop one uses paint events and has extra overhead to ' | 71 'Desktop one uses paint events and has extra overhead to ' |
| 72 'catch paint events.')) | 72 'catch paint events.', |
| 73 higher_is_better=False)) |
| 73 | 74 |
| 74 def IsFinished(self, tab): | 75 def IsFinished(self, tab): |
| 75 """Decide whether the timeline recording should be stopped. | 76 """Decide whether the timeline recording should be stopped. |
| 76 | 77 |
| 77 When the timeline recording is stopped determines which paint events | 78 When the timeline recording is stopped determines which paint events |
| 78 are used in the speed index metric calculation. In general, the recording | 79 are used in the speed index metric calculation. In general, the recording |
| 79 should continue if there has just been some data received, because | 80 should continue if there has just been some data received, because |
| 80 this suggests that painting may continue. | 81 this suggests that painting may continue. |
| 81 | 82 |
| 82 A page may repeatedly request resources in an infinite loop; a timeout | 83 A page may repeatedly request resources in an infinite loop; a timeout |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 frame = paint_event.args['frameId'] | 315 frame = paint_event.args['frameId'] |
| 315 return (frame,) + GetBox(paint_event.args['data']['clip']) | 316 return (frame,) + GetBox(paint_event.args['data']['clip']) |
| 316 | 317 |
| 317 def _GroupEventByRectangle(self, paint_events): | 318 def _GroupEventByRectangle(self, paint_events): |
| 318 """Group all paint events according to the rectangle that they update.""" | 319 """Group all paint events according to the rectangle that they update.""" |
| 319 result = collections.defaultdict(list) | 320 result = collections.defaultdict(list) |
| 320 for event in paint_events: | 321 for event in paint_events: |
| 321 assert event.name == 'Paint' | 322 assert event.name == 'Paint' |
| 322 result[self._GetRectangle(event)].append(event) | 323 result[self._GetRectangle(event)].append(event) |
| 323 return result | 324 return result |
| OLD | NEW |