| 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 #include "cc/debug/rendering_stats_instrumentation.h" | 5 #include "cc/debug/rendering_stats_instrumentation.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 // static | 9 // static |
| 10 scoped_ptr<RenderingStatsInstrumentation> | 10 scoped_ptr<RenderingStatsInstrumentation> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 base::TimeDelta RenderingStatsInstrumentation::EndRecording( | 50 base::TimeDelta RenderingStatsInstrumentation::EndRecording( |
| 51 base::TimeTicks start_time) const { | 51 base::TimeTicks start_time) const { |
| 52 if (!start_time.is_null()) { | 52 if (!start_time.is_null()) { |
| 53 if (base::TimeTicks::IsThreadNowSupported()) | 53 if (base::TimeTicks::IsThreadNowSupported()) |
| 54 return base::TimeTicks::ThreadNow() - start_time; | 54 return base::TimeTicks::ThreadNow() - start_time; |
| 55 return base::TimeTicks::HighResNow() - start_time; | 55 return base::TimeTicks::HighResNow() - start_time; |
| 56 } | 56 } |
| 57 return base::TimeDelta(); | 57 return base::TimeDelta(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void RenderingStatsInstrumentation::IncrementAnimationFrameCount() { | 60 void RenderingStatsInstrumentation::IncrementFrameCount(int64 count, |
| 61 if (!record_rendering_stats_) | 61 bool main_thread) { |
| 62 return; | |
| 63 | |
| 64 base::AutoLock scoped_lock(lock_); | |
| 65 main_stats_.animation_frame_count++; | |
| 66 } | |
| 67 | |
| 68 void RenderingStatsInstrumentation::IncrementScreenFrameCount( | |
| 69 int64 count, bool main_thread) { | |
| 70 if (!record_rendering_stats_) | 62 if (!record_rendering_stats_) |
| 71 return; | 63 return; |
| 72 | 64 |
| 73 base::AutoLock scoped_lock(lock_); | 65 base::AutoLock scoped_lock(lock_); |
| 74 if (main_thread) | 66 if (main_thread) |
| 75 main_stats_.screen_frame_count += count; | 67 main_stats_.frame_count += count; |
| 76 else | 68 else |
| 77 impl_stats_.screen_frame_count += count; | 69 impl_stats_.frame_count += count; |
| 78 } | |
| 79 | |
| 80 void RenderingStatsInstrumentation::IncrementDroppedFrameCount(int64 count) { | |
| 81 if (!record_rendering_stats_) | |
| 82 return; | |
| 83 | |
| 84 base::AutoLock scoped_lock(lock_); | |
| 85 impl_stats_.dropped_frame_count += count; | |
| 86 } | |
| 87 | |
| 88 void RenderingStatsInstrumentation::AddCommit(base::TimeDelta duration) { | |
| 89 if (!record_rendering_stats_) | |
| 90 return; | |
| 91 | |
| 92 base::AutoLock scoped_lock(lock_); | |
| 93 main_stats_.commit_time += duration; | |
| 94 main_stats_.commit_count++; | |
| 95 } | 70 } |
| 96 | 71 |
| 97 void RenderingStatsInstrumentation::AddPaint(base::TimeDelta duration, | 72 void RenderingStatsInstrumentation::AddPaint(base::TimeDelta duration, |
| 98 int64 pixels) { | 73 int64 pixels) { |
| 99 if (!record_rendering_stats_) | 74 if (!record_rendering_stats_) |
| 100 return; | 75 return; |
| 101 | 76 |
| 102 base::AutoLock scoped_lock(lock_); | 77 base::AutoLock scoped_lock(lock_); |
| 103 main_stats_.paint_time += duration; | 78 main_stats_.paint_time += duration; |
| 104 main_stats_.painted_pixel_count += pixels; | 79 main_stats_.painted_pixel_count += pixels; |
| 105 } | 80 } |
| 106 | 81 |
| 107 void RenderingStatsInstrumentation::AddRecord(base::TimeDelta duration, | 82 void RenderingStatsInstrumentation::AddRecord(base::TimeDelta duration, |
| 108 base::TimeDelta best_duration, | |
| 109 int64 pixels) { | 83 int64 pixels) { |
| 110 if (!record_rendering_stats_) | 84 if (!record_rendering_stats_) |
| 111 return; | 85 return; |
| 112 | 86 |
| 113 base::AutoLock scoped_lock(lock_); | 87 base::AutoLock scoped_lock(lock_); |
| 114 main_stats_.record_time += duration; | 88 main_stats_.record_time += duration; |
| 115 main_stats_.best_record_time += best_duration; | |
| 116 main_stats_.recorded_pixel_count += pixels; | 89 main_stats_.recorded_pixel_count += pixels; |
| 117 } | 90 } |
| 118 | 91 |
| 119 void RenderingStatsInstrumentation::AddRaster(base::TimeDelta total_duration, | 92 void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration, |
| 120 base::TimeDelta best_duration, | 93 int64 pixels) { |
| 121 int64 pixels, | |
| 122 bool is_in_pending_tree_now_bin) { | |
| 123 if (!record_rendering_stats_) | 94 if (!record_rendering_stats_) |
| 124 return; | 95 return; |
| 125 | 96 |
| 126 base::AutoLock scoped_lock(lock_); | 97 base::AutoLock scoped_lock(lock_); |
| 127 impl_stats_.rasterize_time += total_duration; | 98 impl_stats_.rasterize_time += duration; |
| 128 impl_stats_.best_rasterize_time += best_duration; | |
| 129 impl_stats_.rasterized_pixel_count += pixels; | 99 impl_stats_.rasterized_pixel_count += pixels; |
| 130 | |
| 131 if (is_in_pending_tree_now_bin) { | |
| 132 impl_stats_.rasterize_time_for_now_bins_on_pending_tree += | |
| 133 total_duration; | |
| 134 } | |
| 135 } | |
| 136 | |
| 137 void RenderingStatsInstrumentation::IncrementImplThreadScrolls() { | |
| 138 if (!record_rendering_stats_) | |
| 139 return; | |
| 140 | |
| 141 base::AutoLock scoped_lock(lock_); | |
| 142 impl_stats_.impl_thread_scroll_count++; | |
| 143 } | |
| 144 | |
| 145 void RenderingStatsInstrumentation::IncrementMainThreadScrolls() { | |
| 146 if (!record_rendering_stats_) | |
| 147 return; | |
| 148 | |
| 149 base::AutoLock scoped_lock(lock_); | |
| 150 impl_stats_.main_thread_scroll_count++; | |
| 151 } | |
| 152 | |
| 153 void RenderingStatsInstrumentation::AddLayersDrawn(int64 amount) { | |
| 154 if (!record_rendering_stats_) | |
| 155 return; | |
| 156 | |
| 157 base::AutoLock scoped_lock(lock_); | |
| 158 impl_stats_.drawn_layer_count += amount; | |
| 159 } | |
| 160 | |
| 161 void RenderingStatsInstrumentation::AddMissingTiles(int64 amount) { | |
| 162 if (!record_rendering_stats_) | |
| 163 return; | |
| 164 | |
| 165 base::AutoLock scoped_lock(lock_); | |
| 166 impl_stats_.missing_tile_count += amount; | |
| 167 } | |
| 168 | |
| 169 void RenderingStatsInstrumentation::AddDeferredImageDecode( | |
| 170 base::TimeDelta duration) { | |
| 171 if (!record_rendering_stats_) | |
| 172 return; | |
| 173 | |
| 174 base::AutoLock scoped_lock(lock_); | |
| 175 impl_stats_.deferred_image_decode_time += duration; | |
| 176 impl_stats_.deferred_image_decode_count++; | |
| 177 } | |
| 178 | |
| 179 void RenderingStatsInstrumentation::AddImageGathering( | |
| 180 base::TimeDelta duration) { | |
| 181 if (!record_rendering_stats_) | |
| 182 return; | |
| 183 | |
| 184 base::AutoLock scoped_lock(lock_); | |
| 185 main_stats_.image_gathering_time += duration; | |
| 186 main_stats_.image_gathering_count++; | |
| 187 } | |
| 188 | |
| 189 void RenderingStatsInstrumentation::IncrementDeferredImageCacheHitCount() { | |
| 190 if (!record_rendering_stats_) | |
| 191 return; | |
| 192 | |
| 193 base::AutoLock scoped_lock(lock_); | |
| 194 impl_stats_.deferred_image_cache_hit_count++; | |
| 195 } | |
| 196 | |
| 197 void RenderingStatsInstrumentation::AddAnalysisResult( | |
| 198 base::TimeDelta duration, | |
| 199 bool is_solid_color) { | |
| 200 if (!record_rendering_stats_) | |
| 201 return; | |
| 202 | |
| 203 base::AutoLock scoped_lock(lock_); | |
| 204 impl_stats_.tile_analysis_count++; | |
| 205 impl_stats_.tile_analysis_time += duration; | |
| 206 if (is_solid_color) | |
| 207 impl_stats_.solid_color_tile_analysis_count++; | |
| 208 } | 100 } |
| 209 | 101 |
| 210 } // namespace cc | 102 } // namespace cc |
| OLD | NEW |