| 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 #include <stdio.h> |
| 8 |
| 7 namespace cc { | 9 namespace cc { |
| 8 | 10 |
| 9 // static | 11 // static |
| 10 scoped_ptr<RenderingStatsInstrumentation> | 12 scoped_ptr<RenderingStatsInstrumentation> |
| 11 RenderingStatsInstrumentation::Create() { | 13 RenderingStatsInstrumentation::Create() { |
| 14 printf("RenderingStatsInstrumentation::Create\n"); |
| 12 return make_scoped_ptr(new RenderingStatsInstrumentation()); | 15 return make_scoped_ptr(new RenderingStatsInstrumentation()); |
| 13 } | 16 } |
| 14 | 17 |
| 15 RenderingStatsInstrumentation::RenderingStatsInstrumentation() | 18 RenderingStatsInstrumentation::RenderingStatsInstrumentation() |
| 16 : record_rendering_stats_(false) { | 19 : record_rendering_stats_(false) { |
| 20 printf("RenderingStatsInstrumentation\n"); |
| 17 } | 21 } |
| 18 | 22 |
| 19 RenderingStatsInstrumentation::~RenderingStatsInstrumentation() {} | 23 RenderingStatsInstrumentation::~RenderingStatsInstrumentation() { |
| 24 printf("~RenderingStatsInstrumentation\n"); |
| 25 } |
| 20 | 26 |
| 21 RenderingStats RenderingStatsInstrumentation::GetRenderingStats() { | 27 RenderingStats RenderingStatsInstrumentation::GetRenderingStats() { |
| 28 printf("RenderingStatsInstrumentation::GetRenderingStats\n"); |
| 29 printf("create autolock\n"); |
| 22 base::AutoLock scoped_lock(lock_); | 30 base::AutoLock scoped_lock(lock_); |
| 23 return rendering_stats_; | 31 return rendering_stats_; |
| 32 printf("destroy autolock\n"); |
| 24 } | 33 } |
| 25 | 34 |
| 26 base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { | 35 base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { |
| 27 if (record_rendering_stats_) | 36 if (record_rendering_stats_) |
| 28 return base::TimeTicks::HighResNow(); | 37 return base::TimeTicks::HighResNow(); |
| 29 return base::TimeTicks(); | 38 return base::TimeTicks(); |
| 30 } | 39 } |
| 31 | 40 |
| 32 base::TimeDelta RenderingStatsInstrumentation::EndRecording( | 41 base::TimeDelta RenderingStatsInstrumentation::EndRecording( |
| 33 base::TimeTicks start_time) const { | 42 base::TimeTicks start_time) const { |
| 34 if (!start_time.is_null()) | 43 if (!start_time.is_null()) |
| 35 return base::TimeTicks::HighResNow() - start_time; | 44 return base::TimeTicks::HighResNow() - start_time; |
| 36 return base::TimeDelta(); | 45 return base::TimeDelta(); |
| 37 } | 46 } |
| 38 | 47 |
| 39 void RenderingStatsInstrumentation::AddStats(const RenderingStats& other) { | 48 void RenderingStatsInstrumentation::AddStats(const RenderingStats& other) { |
| 49 printf("RenderingStatsInstrumentation::AddStats\n"); |
| 40 if (!record_rendering_stats_) | 50 if (!record_rendering_stats_) |
| 41 return; | 51 return; |
| 42 | 52 printf("create autolock\n"); |
| 43 base::AutoLock scoped_lock(lock_); | 53 base::AutoLock scoped_lock(lock_); |
| 44 rendering_stats_.Add(other); | 54 rendering_stats_.Add(other); |
| 55 printf("destroy autolock\n"); |
| 45 } | 56 } |
| 46 | 57 |
| 47 void RenderingStatsInstrumentation::IncrementAnimationFrameCount() { | 58 void RenderingStatsInstrumentation::IncrementAnimationFrameCount() { |
| 59 printf("RenderingStatsInstrumentation::IncrementAnimationFrameCount\n"); |
| 48 if (!record_rendering_stats_) | 60 if (!record_rendering_stats_) |
| 49 return; | 61 return; |
| 50 | 62 printf("create autolock\n"); |
| 51 base::AutoLock scoped_lock(lock_); | 63 base::AutoLock scoped_lock(lock_); |
| 52 rendering_stats_.animation_frame_count++; | 64 rendering_stats_.animation_frame_count++; |
| 65 printf("destroy autolock\n"); |
| 53 } | 66 } |
| 54 | 67 |
| 55 void RenderingStatsInstrumentation::SetScreenFrameCount(int64 count) { | 68 void RenderingStatsInstrumentation::SetScreenFrameCount(int64 count) { |
| 69 printf("RenderingStatsInstrumentation::SetScreenFrameCount\n"); |
| 56 if (!record_rendering_stats_) | 70 if (!record_rendering_stats_) |
| 57 return; | 71 return; |
| 58 | 72 printf("create autolock\n"); |
| 59 base::AutoLock scoped_lock(lock_); | 73 base::AutoLock scoped_lock(lock_); |
| 60 rendering_stats_.screen_frame_count = count; | 74 rendering_stats_.screen_frame_count = count; |
| 75 printf("destroy autolock\n"); |
| 61 } | 76 } |
| 62 | 77 |
| 63 void RenderingStatsInstrumentation::SetDroppedFrameCount(int64 count) { | 78 void RenderingStatsInstrumentation::SetDroppedFrameCount(int64 count) { |
| 79 printf("RenderingStatsInstrumentation::SetDroppedFrameCount\n"); |
| 64 if (!record_rendering_stats_) | 80 if (!record_rendering_stats_) |
| 65 return; | 81 return; |
| 66 | 82 printf("create autolock\n"); |
| 67 base::AutoLock scoped_lock(lock_); | 83 base::AutoLock scoped_lock(lock_); |
| 68 rendering_stats_.dropped_frame_count = count; | 84 rendering_stats_.dropped_frame_count = count; |
| 85 printf("destroy autolock\n"); |
| 69 } | 86 } |
| 70 | 87 |
| 71 void RenderingStatsInstrumentation::AddCommit(base::TimeDelta duration) { | 88 void RenderingStatsInstrumentation::AddCommit(base::TimeDelta duration) { |
| 89 printf("RenderingStatsInstrumentation::AddCommit\n"); |
| 72 if (!record_rendering_stats_) | 90 if (!record_rendering_stats_) |
| 73 return; | 91 return; |
| 74 | 92 printf("create autolock\n"); |
| 75 base::AutoLock scoped_lock(lock_); | 93 base::AutoLock scoped_lock(lock_); |
| 76 rendering_stats_.total_commit_time += duration; | 94 rendering_stats_.total_commit_time += duration; |
| 77 rendering_stats_.total_commit_count++; | 95 rendering_stats_.total_commit_count++; |
| 96 printf("destroy autolock\n"); |
| 78 } | 97 } |
| 79 | 98 |
| 80 void RenderingStatsInstrumentation::AddPaint(base::TimeDelta duration, | 99 void RenderingStatsInstrumentation::AddPaint(base::TimeDelta duration, |
| 81 int64 pixels) { | 100 int64 pixels) { |
| 101 printf("RenderingStatsInstrumentation::AddPaint\n"); |
| 82 if (!record_rendering_stats_) | 102 if (!record_rendering_stats_) |
| 83 return; | 103 return; |
| 84 | 104 printf("create autolock\n"); |
| 85 base::AutoLock scoped_lock(lock_); | 105 base::AutoLock scoped_lock(lock_); |
| 86 rendering_stats_.total_paint_time += duration; | 106 rendering_stats_.total_paint_time += duration; |
| 87 rendering_stats_.total_pixels_painted += pixels; | 107 rendering_stats_.total_pixels_painted += pixels; |
| 108 printf("destroy autolock\n"); |
| 88 } | 109 } |
| 89 | 110 |
| 90 void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration, | 111 void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration, |
| 91 int64 pixels, | 112 int64 pixels, |
| 92 bool is_in_pending_tree_now_bin) { | 113 bool is_in_pending_tree_now_bin) { |
| 114 printf("RenderingStatsInstrumentation::AddRaster\n"); |
| 93 if (!record_rendering_stats_) | 115 if (!record_rendering_stats_) |
| 94 return; | 116 return; |
| 95 | 117 printf("create autolock\n"); |
| 96 base::AutoLock scoped_lock(lock_); | 118 base::AutoLock scoped_lock(lock_); |
| 97 rendering_stats_.total_rasterize_time += duration; | 119 rendering_stats_.total_rasterize_time += duration; |
| 98 rendering_stats_.total_pixels_rasterized += pixels; | 120 rendering_stats_.total_pixels_rasterized += pixels; |
| 99 | 121 |
| 100 if (is_in_pending_tree_now_bin) { | 122 if (is_in_pending_tree_now_bin) { |
| 101 rendering_stats_.total_rasterize_time_for_now_bins_on_pending_tree += | 123 rendering_stats_.total_rasterize_time_for_now_bins_on_pending_tree += |
| 102 duration; | 124 duration; |
| 103 } | 125 } |
| 126 printf("destroy autolock\n"); |
| 104 } | 127 } |
| 105 | 128 |
| 106 void RenderingStatsInstrumentation::IncrementImplThreadScrolls() { | 129 void RenderingStatsInstrumentation::IncrementImplThreadScrolls() { |
| 130 printf("RenderingStatsInstrumentation::IncrementImplThreadScrolls\n"); |
| 107 if (!record_rendering_stats_) | 131 if (!record_rendering_stats_) |
| 108 return; | 132 return; |
| 109 | 133 printf("create autolock\n"); |
| 110 base::AutoLock scoped_lock(lock_); | 134 base::AutoLock scoped_lock(lock_); |
| 111 rendering_stats_.num_impl_thread_scrolls++; | 135 rendering_stats_.num_impl_thread_scrolls++; |
| 136 printf("destroy autolock\n"); |
| 112 } | 137 } |
| 113 | 138 |
| 114 void RenderingStatsInstrumentation::IncrementMainThreadScrolls() { | 139 void RenderingStatsInstrumentation::IncrementMainThreadScrolls() { |
| 140 printf("RenderingStatsInstrumentation::IncrementMainThreadScrolls\n"); |
| 115 if (!record_rendering_stats_) | 141 if (!record_rendering_stats_) |
| 116 return; | 142 return; |
| 117 | 143 printf("create autolock\n"); |
| 118 base::AutoLock scoped_lock(lock_); | 144 base::AutoLock scoped_lock(lock_); |
| 119 rendering_stats_.num_main_thread_scrolls++; | 145 rendering_stats_.num_main_thread_scrolls++; |
| 146 printf("destroy autolock\n"); |
| 120 } | 147 } |
| 121 | 148 |
| 122 void RenderingStatsInstrumentation::AddLayersDrawn(int64 amount) { | 149 void RenderingStatsInstrumentation::AddLayersDrawn(int64 amount) { |
| 150 printf("RenderingStatsInstrumentation::AddLayersDrawn\n"); |
| 123 if (!record_rendering_stats_) | 151 if (!record_rendering_stats_) |
| 124 return; | 152 return; |
| 125 | 153 printf("create autolock\n"); |
| 126 base::AutoLock scoped_lock(lock_); | 154 base::AutoLock scoped_lock(lock_); |
| 127 rendering_stats_.num_layers_drawn += amount; | 155 rendering_stats_.num_layers_drawn += amount; |
| 156 printf("destroy autolock\n"); |
| 128 } | 157 } |
| 129 | 158 |
| 130 void RenderingStatsInstrumentation::AddMissingTiles(int64 amount) { | 159 void RenderingStatsInstrumentation::AddMissingTiles(int64 amount) { |
| 160 printf("RenderingStatsInstrumentation::AddMissingTiles\n"); |
| 131 if (!record_rendering_stats_) | 161 if (!record_rendering_stats_) |
| 132 return; | 162 return; |
| 133 | 163 printf("create autolock\n"); |
| 134 base::AutoLock scoped_lock(lock_); | 164 base::AutoLock scoped_lock(lock_); |
| 135 rendering_stats_.num_missing_tiles += amount; | 165 rendering_stats_.num_missing_tiles += amount; |
| 166 printf("destroy autolock\n"); |
| 136 } | 167 } |
| 137 | 168 |
| 138 void RenderingStatsInstrumentation::AddDeferredImageDecode( | 169 void RenderingStatsInstrumentation::AddDeferredImageDecode( |
| 139 base::TimeDelta duration) { | 170 base::TimeDelta duration) { |
| 171 printf("RenderingStatsInstrumentation::AddDeferredImageDecode\n"); |
| 140 if (!record_rendering_stats_) | 172 if (!record_rendering_stats_) |
| 141 return; | 173 return; |
| 142 | 174 printf("create autolock\n"); |
| 143 base::AutoLock scoped_lock(lock_); | 175 base::AutoLock scoped_lock(lock_); |
| 144 rendering_stats_.total_deferred_image_decode_time += duration; | 176 rendering_stats_.total_deferred_image_decode_time += duration; |
| 145 rendering_stats_.total_deferred_image_decode_count++; | 177 rendering_stats_.total_deferred_image_decode_count++; |
| 178 printf("destroy autolock\n"); |
| 146 } | 179 } |
| 147 | 180 |
| 148 void RenderingStatsInstrumentation::AddImageGathering( | 181 void RenderingStatsInstrumentation::AddImageGathering( |
| 149 base::TimeDelta duration) { | 182 base::TimeDelta duration) { |
| 183 printf("RenderingStatsInstrumentation::AddImageGathering\n"); |
| 150 if (!record_rendering_stats_) | 184 if (!record_rendering_stats_) |
| 151 return; | 185 return; |
| 152 | 186 |
| 187 printf("create autolock\n"); |
| 153 base::AutoLock scoped_lock(lock_); | 188 base::AutoLock scoped_lock(lock_); |
| 154 rendering_stats_.total_image_gathering_time += duration; | 189 rendering_stats_.total_image_gathering_time += duration; |
| 155 rendering_stats_.total_image_gathering_count++; | 190 rendering_stats_.total_image_gathering_count++; |
| 191 printf("destroy autolock\n"); |
| 156 } | 192 } |
| 157 | 193 |
| 158 void RenderingStatsInstrumentation::IncrementDeferredImageCacheHitCount() { | 194 void RenderingStatsInstrumentation::IncrementDeferredImageCacheHitCount() { |
| 195 printf("RenderingStatsInstrumentation::IncrementDeferredImageCacheHitCount\n")
; |
| 159 if (!record_rendering_stats_) | 196 if (!record_rendering_stats_) |
| 160 return; | 197 return; |
| 161 | 198 |
| 199 printf("create autolock\n"); |
| 162 base::AutoLock scoped_lock(lock_); | 200 base::AutoLock scoped_lock(lock_); |
| 163 rendering_stats_.total_deferred_image_cache_hit_count++; | 201 rendering_stats_.total_deferred_image_cache_hit_count++; |
| 202 printf("destroy autolock\n"); |
| 164 } | 203 } |
| 165 | 204 |
| 166 } // namespace cc | 205 } // namespace cc |
| OLD | NEW |