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 19 matching lines...) Expand all Loading... |
30 rendering_stats.Add(impl_thread_rendering_stats_); | 30 rendering_stats.Add(impl_thread_rendering_stats_); |
31 return rendering_stats; | 31 return rendering_stats; |
32 } | 32 } |
33 | 33 |
34 void RenderingStatsInstrumentation::AccumulateAndClearImplThreadStats() { | 34 void RenderingStatsInstrumentation::AccumulateAndClearImplThreadStats() { |
35 base::AutoLock scoped_lock(lock_); | 35 base::AutoLock scoped_lock(lock_); |
36 impl_thread_rendering_stats_accu_.Add(impl_thread_rendering_stats_); | 36 impl_thread_rendering_stats_accu_.Add(impl_thread_rendering_stats_); |
37 impl_thread_rendering_stats_ = RenderingStats(); | 37 impl_thread_rendering_stats_ = RenderingStats(); |
38 } | 38 } |
39 | 39 |
40 base::TimeTicks RenderingStatsInstrumentation::StartRecording() const { | 40 base::TimeDelta RenderingStatsInstrumentation::StartRecording() const { |
41 if (record_rendering_stats_) { | 41 if (record_rendering_stats_) { |
42 if (base::TimeTicks::IsThreadNowSupported()) | 42 if (base::ThreadTicks::IsSupported()) |
43 return base::TimeTicks::ThreadNow(); | 43 return base::ThreadTicks::Now() - base::ThreadTicks(); |
44 return base::TimeTicks::Now(); | 44 return base::TimeTicks::Now() - base::TimeTicks(); |
45 } | 45 } |
46 return base::TimeTicks(); | 46 return base::TimeDelta(); |
47 } | 47 } |
48 | 48 |
49 base::TimeDelta RenderingStatsInstrumentation::EndRecording( | 49 base::TimeDelta RenderingStatsInstrumentation::EndRecording( |
50 base::TimeTicks start_time) const { | 50 base::TimeDelta start_time) const { |
51 if (!start_time.is_null()) { | 51 if (start_time != base::TimeDelta()) { |
52 if (base::TimeTicks::IsThreadNowSupported()) | 52 if (base::ThreadTicks::IsSupported()) |
53 return base::TimeTicks::ThreadNow() - start_time; | 53 return (base::ThreadTicks::Now() - base::ThreadTicks()) - start_time; |
54 return base::TimeTicks::Now() - start_time; | 54 return (base::TimeTicks::Now() - base::TimeTicks()) - start_time; |
55 } | 55 } |
56 return base::TimeDelta(); | 56 return base::TimeDelta(); |
57 } | 57 } |
58 | 58 |
59 void RenderingStatsInstrumentation::IncrementFrameCount(int64 count) { | 59 void RenderingStatsInstrumentation::IncrementFrameCount(int64 count) { |
60 if (!record_rendering_stats_) | 60 if (!record_rendering_stats_) |
61 return; | 61 return; |
62 | 62 |
63 base::AutoLock scoped_lock(lock_); | 63 base::AutoLock scoped_lock(lock_); |
64 impl_thread_rendering_stats_.frame_count += count; | 64 impl_thread_rendering_stats_.frame_count += count; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return; | 122 return; |
123 | 123 |
124 base::AutoLock scoped_lock(lock_); | 124 base::AutoLock scoped_lock(lock_); |
125 impl_thread_rendering_stats_.commit_to_activate_duration.Append( | 125 impl_thread_rendering_stats_.commit_to_activate_duration.Append( |
126 commit_to_activate_duration); | 126 commit_to_activate_duration); |
127 impl_thread_rendering_stats_.commit_to_activate_duration_estimate.Append( | 127 impl_thread_rendering_stats_.commit_to_activate_duration_estimate.Append( |
128 commit_to_activate_duration_estimate); | 128 commit_to_activate_duration_estimate); |
129 } | 129 } |
130 | 130 |
131 } // namespace cc | 131 } // namespace cc |
OLD | NEW |