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 random | 5 import random |
6 import unittest | 6 import unittest |
7 | 7 |
8 from metrics.rendering_stats import RenderingStats | 8 from metrics.rendering_stats import RenderingStats |
9 from telemetry.core.timeline import model | 9 from telemetry.core.timeline import model |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 data = { 'frame_count': 0, | 53 data = { 'frame_count': 0, |
54 'paint_time': 0.0, | 54 'paint_time': 0.0, |
55 'painted_pixel_count': 0, | 55 'painted_pixel_count': 0, |
56 'record_time': mock_timer.Advance(2, 4) / 1000.0, | 56 'record_time': mock_timer.Advance(2, 4) / 1000.0, |
57 'recorded_pixel_count': 3000*3000 } | 57 'recorded_pixel_count': 3000*3000 } |
58 timestamp = mock_timer.Get() | 58 timestamp = mock_timer.Get() |
59 | 59 |
60 # Add a slice with the event data to the given thread. | 60 # Add a slice with the event data to the given thread. |
61 thread.PushCompleteSlice( | 61 thread.PushCompleteSlice( |
62 'benchmark', 'BenchmarkInstrumentation::MainThreadRenderingStats', | 62 'benchmark', 'BenchmarkInstrumentation::MainThreadRenderingStats', |
63 timestamp, 0.0, {'data': data}) | 63 timestamp, 0.0, None, None, {'data': data}) |
nduca
2013/12/03 07:18:55
here and elsewhere, after the timestamp parameter,
ernstm
2013/12/03 20:55:54
Done.
| |
64 | 64 |
65 if not ref_stats: | 65 if not ref_stats: |
66 return | 66 return |
67 | 67 |
68 # Add timestamp only if a frame was output | 68 # Add timestamp only if a frame was output |
69 if data['frame_count'] == 1: | 69 if data['frame_count'] == 1: |
70 if not first_frame: | 70 if not first_frame: |
71 # Add frame_time if this is not the first frame in within the bounds of an | 71 # Add frame_time if this is not the first frame in within the bounds of an |
72 # action. | 72 # action. |
73 prev_timestamp = ref_stats.frame_timestamps[-1] | 73 prev_timestamp = ref_stats.frame_timestamps[-1] |
(...skipping 16 matching lines...) Expand all Loading... | |
90 """ | 90 """ |
91 # Create randonm data and timestap for impl thread rendering stats. | 91 # Create randonm data and timestap for impl thread rendering stats. |
92 data = { 'frame_count': 1, | 92 data = { 'frame_count': 1, |
93 'rasterize_time': mock_timer.Advance(5, 10) / 1000.0, | 93 'rasterize_time': mock_timer.Advance(5, 10) / 1000.0, |
94 'rasterized_pixel_count': 1280*720 } | 94 'rasterized_pixel_count': 1280*720 } |
95 timestamp = mock_timer.Get() | 95 timestamp = mock_timer.Get() |
96 | 96 |
97 # Add a slice with the event data to the given thread. | 97 # Add a slice with the event data to the given thread. |
98 thread.PushCompleteSlice( | 98 thread.PushCompleteSlice( |
99 'benchmark', 'BenchmarkInstrumentation::ImplThreadRenderingStats', | 99 'benchmark', 'BenchmarkInstrumentation::ImplThreadRenderingStats', |
100 timestamp, 0.0, {'data': data}) | 100 timestamp, 0.0, None, None, {'data': data}) |
101 | 101 |
102 if not ref_stats: | 102 if not ref_stats: |
103 return | 103 return |
104 | 104 |
105 # Add timestamp only if a frame was output | 105 # Add timestamp only if a frame was output |
106 if data['frame_count'] == 1: | 106 if data['frame_count'] == 1: |
107 if not first_frame: | 107 if not first_frame: |
108 # Add frame_time if this is not the first frame in within the bounds of an | 108 # Add frame_time if this is not the first frame in within the bounds of an |
109 # action. | 109 # action. |
110 prev_timestamp = ref_stats.frame_timestamps[-1] | 110 prev_timestamp = ref_stats.frame_timestamps[-1] |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 self.assertEquals(stats.frame_timestamps, ref_stats.frame_timestamps) | 183 self.assertEquals(stats.frame_timestamps, ref_stats.frame_timestamps) |
184 self.assertEquals(stats.frame_times, ref_stats.frame_times) | 184 self.assertEquals(stats.frame_times, ref_stats.frame_times) |
185 self.assertEquals(stats.rasterize_time, ref_stats.rasterize_time) | 185 self.assertEquals(stats.rasterize_time, ref_stats.rasterize_time) |
186 self.assertEquals(stats.rasterized_pixel_count, | 186 self.assertEquals(stats.rasterized_pixel_count, |
187 ref_stats.rasterized_pixel_count) | 187 ref_stats.rasterized_pixel_count) |
188 self.assertEquals(stats.paint_time, ref_stats.paint_time) | 188 self.assertEquals(stats.paint_time, ref_stats.paint_time) |
189 self.assertEquals(stats.painted_pixel_count, ref_stats.painted_pixel_count) | 189 self.assertEquals(stats.painted_pixel_count, ref_stats.painted_pixel_count) |
190 self.assertEquals(stats.record_time, ref_stats.record_time) | 190 self.assertEquals(stats.record_time, ref_stats.record_time) |
191 self.assertEquals(stats.recorded_pixel_count, | 191 self.assertEquals(stats.recorded_pixel_count, |
192 ref_stats.recorded_pixel_count) | 192 ref_stats.recorded_pixel_count) |
OLD | NEW |