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