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 21 matching lines...) Expand all Loading... |
32 main_stats_accu_.Add(main_stats_); | 32 main_stats_accu_.Add(main_stats_); |
33 main_stats_ = MainThreadRenderingStats(); | 33 main_stats_ = MainThreadRenderingStats(); |
34 } | 34 } |
35 | 35 |
36 void RenderingStatsInstrumentation::AccumulateAndClearImplThreadStats() { | 36 void RenderingStatsInstrumentation::AccumulateAndClearImplThreadStats() { |
37 impl_stats_accu_.Add(impl_stats_); | 37 impl_stats_accu_.Add(impl_stats_); |
38 impl_stats_ = ImplThreadRenderingStats(); | 38 impl_stats_ = ImplThreadRenderingStats(); |
39 } | 39 } |
40 | 40 |
41 base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { | 41 base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { |
42 if (record_rendering_stats_) | 42 if (record_rendering_stats_) { |
| 43 if (base::TimeTicks::IsThreadNowSupported()) |
| 44 return base::TimeTicks::ThreadNow(); |
43 return base::TimeTicks::HighResNow(); | 45 return base::TimeTicks::HighResNow(); |
| 46 } |
44 return base::TimeTicks(); | 47 return base::TimeTicks(); |
45 } | 48 } |
46 | 49 |
47 base::TimeDelta RenderingStatsInstrumentation::EndRecording( | 50 base::TimeDelta RenderingStatsInstrumentation::EndRecording( |
48 base::TimeTicks start_time) const { | 51 base::TimeTicks start_time) const { |
49 if (!start_time.is_null()) | 52 if (!start_time.is_null()) { |
| 53 if (base::TimeTicks::IsThreadNowSupported()) |
| 54 return base::TimeTicks::ThreadNow() - start_time; |
50 return base::TimeTicks::HighResNow() - start_time; | 55 return base::TimeTicks::HighResNow() - start_time; |
| 56 } |
51 return base::TimeDelta(); | 57 return base::TimeDelta(); |
52 } | 58 } |
53 | 59 |
54 void RenderingStatsInstrumentation::IncrementAnimationFrameCount() { | 60 void RenderingStatsInstrumentation::IncrementAnimationFrameCount() { |
55 if (!record_rendering_stats_) | 61 if (!record_rendering_stats_) |
56 return; | 62 return; |
57 | 63 |
58 base::AutoLock scoped_lock(lock_); | 64 base::AutoLock scoped_lock(lock_); |
59 main_stats_.animation_frame_count++; | 65 main_stats_.animation_frame_count++; |
60 } | 66 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return; | 199 return; |
194 | 200 |
195 base::AutoLock scoped_lock(lock_); | 201 base::AutoLock scoped_lock(lock_); |
196 impl_stats_.tile_analysis_count++; | 202 impl_stats_.tile_analysis_count++; |
197 impl_stats_.tile_analysis_time += duration; | 203 impl_stats_.tile_analysis_time += duration; |
198 if (is_solid_color) | 204 if (is_solid_color) |
199 impl_stats_.solid_color_tile_analysis_count++; | 205 impl_stats_.solid_color_tile_analysis_count++; |
200 } | 206 } |
201 | 207 |
202 } // namespace cc | 208 } // namespace cc |
OLD | NEW |