OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/trees/proxy_timing_history.h" | 5 #include "cc/trees/proxy_timing_history.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 | 8 |
9 const size_t kDurationHistorySize = 60; | 9 const size_t kDurationHistorySize = 60; |
10 const double kCommitAndActivationDurationEstimationPercentile = 50.0; | 10 const double kCommitAndActivationDurationEstimationPercentile = 50.0; |
(...skipping 25 matching lines...) Expand all Loading... |
36 return begin_main_frame_to_commit_duration_history_.Percentile( | 36 return begin_main_frame_to_commit_duration_history_.Percentile( |
37 kCommitAndActivationDurationEstimationPercentile); | 37 kCommitAndActivationDurationEstimationPercentile); |
38 } | 38 } |
39 | 39 |
40 base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const { | 40 base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const { |
41 return commit_to_activate_duration_history_.Percentile( | 41 return commit_to_activate_duration_history_.Percentile( |
42 kCommitAndActivationDurationEstimationPercentile); | 42 kCommitAndActivationDurationEstimationPercentile); |
43 } | 43 } |
44 | 44 |
45 void ProxyTimingHistory::DidBeginMainFrame() { | 45 void ProxyTimingHistory::DidBeginMainFrame() { |
46 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow(); | 46 begin_main_frame_sent_time_ = base::TimeTicks::Now(); |
47 } | 47 } |
48 | 48 |
49 void ProxyTimingHistory::DidCommit() { | 49 void ProxyTimingHistory::DidCommit() { |
50 commit_complete_time_ = base::TimeTicks::HighResNow(); | 50 commit_complete_time_ = base::TimeTicks::Now(); |
51 base::TimeDelta begin_main_frame_to_commit_duration = | 51 base::TimeDelta begin_main_frame_to_commit_duration = |
52 commit_complete_time_ - begin_main_frame_sent_time_; | 52 commit_complete_time_ - begin_main_frame_sent_time_; |
53 | 53 |
54 // Before adding the new data point to the timing history, see what we would | 54 // Before adding the new data point to the timing history, see what we would |
55 // have predicted for this frame. This allows us to keep track of the accuracy | 55 // have predicted for this frame. This allows us to keep track of the accuracy |
56 // of our predictions. | 56 // of our predictions. |
57 rendering_stats_instrumentation_->AddBeginMainFrameToCommitDuration( | 57 rendering_stats_instrumentation_->AddBeginMainFrameToCommitDuration( |
58 begin_main_frame_to_commit_duration, | 58 begin_main_frame_to_commit_duration, |
59 BeginMainFrameToCommitDurationEstimate()); | 59 BeginMainFrameToCommitDurationEstimate()); |
60 | 60 |
61 begin_main_frame_to_commit_duration_history_.InsertSample( | 61 begin_main_frame_to_commit_duration_history_.InsertSample( |
62 begin_main_frame_to_commit_duration); | 62 begin_main_frame_to_commit_duration); |
63 } | 63 } |
64 | 64 |
65 void ProxyTimingHistory::DidActivateSyncTree() { | 65 void ProxyTimingHistory::DidActivateSyncTree() { |
66 base::TimeDelta commit_to_activate_duration = | 66 base::TimeDelta commit_to_activate_duration = |
67 base::TimeTicks::HighResNow() - commit_complete_time_; | 67 base::TimeTicks::Now() - commit_complete_time_; |
68 | 68 |
69 // Before adding the new data point to the timing history, see what we would | 69 // Before adding the new data point to the timing history, see what we would |
70 // have predicted for this frame. This allows us to keep track of the accuracy | 70 // have predicted for this frame. This allows us to keep track of the accuracy |
71 // of our predictions. | 71 // of our predictions. |
72 rendering_stats_instrumentation_->AddCommitToActivateDuration( | 72 rendering_stats_instrumentation_->AddCommitToActivateDuration( |
73 commit_to_activate_duration, CommitToActivateDurationEstimate()); | 73 commit_to_activate_duration, CommitToActivateDurationEstimate()); |
74 | 74 |
75 commit_to_activate_duration_history_.InsertSample( | 75 commit_to_activate_duration_history_.InsertSample( |
76 commit_to_activate_duration); | 76 commit_to_activate_duration); |
77 } | 77 } |
78 | 78 |
79 void ProxyTimingHistory::DidStartDrawing() { | 79 void ProxyTimingHistory::DidStartDrawing() { |
80 start_draw_time_ = base::TimeTicks::HighResNow(); | 80 start_draw_time_ = base::TimeTicks::Now(); |
81 } | 81 } |
82 | 82 |
83 void ProxyTimingHistory::DidFinishDrawing() { | 83 void ProxyTimingHistory::DidFinishDrawing() { |
84 base::TimeDelta draw_duration = | 84 base::TimeDelta draw_duration = base::TimeTicks::Now() - start_draw_time_; |
85 base::TimeTicks::HighResNow() - start_draw_time_; | |
86 | 85 |
87 // Before adding the new data point to the timing history, see what we would | 86 // Before adding the new data point to the timing history, see what we would |
88 // have predicted for this frame. This allows us to keep track of the accuracy | 87 // have predicted for this frame. This allows us to keep track of the accuracy |
89 // of our predictions. | 88 // of our predictions. |
90 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); | 89 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); |
91 rendering_stats_instrumentation_->AddDrawDuration(draw_duration, | 90 rendering_stats_instrumentation_->AddDrawDuration(draw_duration, |
92 draw_duration_estimate); | 91 draw_duration_estimate); |
93 | 92 |
94 AddDrawDurationUMA(draw_duration, draw_duration_estimate); | 93 AddDrawDurationUMA(draw_duration, draw_duration_estimate); |
95 | 94 |
(...skipping 20 matching lines...) Expand all Loading... |
116 base::TimeDelta::FromMilliseconds(100), | 115 base::TimeDelta::FromMilliseconds(100), |
117 50); | 116 50); |
118 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", | 117 UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate", |
119 draw_duration_overestimate, | 118 draw_duration_overestimate, |
120 base::TimeDelta::FromMilliseconds(1), | 119 base::TimeDelta::FromMilliseconds(1), |
121 base::TimeDelta::FromMilliseconds(100), | 120 base::TimeDelta::FromMilliseconds(100), |
122 50); | 121 50); |
123 } | 122 } |
124 | 123 |
125 } // namespace cc | 124 } // namespace cc |
OLD | NEW |