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 operator import attrgetter | 5 from operator import attrgetter |
6 | 6 |
7 RENDER_PROCESS_MARKER = 'RenderProcessMarker' | |
8 | |
9 | 7 |
10 class RenderingStats(object): | 8 class RenderingStats(object): |
11 def __init__(self, render_process_marker, timeline_markers): | 9 def __init__(self, renderer_process, timeline_markers): |
12 """ | 10 """ |
13 Utility class for extracting rendering statistics from the timeline (or | 11 Utility class for extracting rendering statistics from the timeline (or |
14 other loggin facilities), and providing them in a common format to classes | 12 other loggin facilities), and providing them in a common format to classes |
15 that compute benchmark metrics from this data. | 13 that compute benchmark metrics from this data. |
16 | 14 |
17 Stats can either be numbers, or lists of numbers. Classes that calculate | 15 Stats can either be numbers, or lists of numbers. Classes that calculate |
18 metrics from the stats must be able to handle both cases. The length of | 16 metrics from the stats must be able to handle both cases. The length of |
19 different list stats may vary. | 17 different list stats may vary. |
20 | 18 |
21 All *_time values are measured in milliseconds. | 19 All *_time values are measured in milliseconds. |
22 """ | 20 """ |
23 assert(len(render_process_marker) == 1) | |
24 assert(len(timeline_markers) > 0) | 21 assert(len(timeline_markers) > 0) |
25 self.renderer_process = render_process_marker[0].start_thread.parent | 22 self.renderer_process = renderer_process |
26 self.start = timeline_markers[0].start | 23 self.start = timeline_markers[0].start |
27 self.end = timeline_markers[-1].start + timeline_markers[-1].duration | 24 self.end = timeline_markers[-1].start + timeline_markers[-1].duration |
28 | 25 |
29 self.frame_count = [] | 26 self.frame_count = [] |
30 self.frame_timestamps = [] | 27 self.frame_timestamps = [] |
31 self.frame_times = [] | 28 self.frame_times = [] |
32 self.paint_time = [] | 29 self.paint_time = [] |
33 self.painted_pixel_count = [] | 30 self.painted_pixel_count = [] |
34 self.record_time = [] | 31 self.record_time = [] |
35 self.recorded_pixel_count = [] | 32 self.recorded_pixel_count = [] |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 self.frame_timestamps.append( | 111 self.frame_timestamps.append( |
115 event.start) | 112 event.start) |
116 if not first_frame: | 113 if not first_frame: |
117 self.frame_times.append(round(self.frame_timestamps[-1] - | 114 self.frame_times.append(round(self.frame_timestamps[-1] - |
118 self.frame_timestamps[-2], 2)) | 115 self.frame_timestamps[-2], 2)) |
119 first_frame = False | 116 first_frame = False |
120 self.rasterize_time.append(1000.0 * | 117 self.rasterize_time.append(1000.0 * |
121 event.args['data']['rasterize_time']) | 118 event.args['data']['rasterize_time']) |
122 self.rasterized_pixel_count.append( | 119 self.rasterized_pixel_count.append( |
123 event.args['data']['rasterized_pixel_count']) | 120 event.args['data']['rasterized_pixel_count']) |
OLD | NEW |