| 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 const size_t kDurationHistorySize = 60; | 7 const size_t kDurationHistorySize = 60; |
| 8 const double kCommitAndActivationDurationEstimationPercentile = 50.0; | 8 const double kCommitAndActivationDurationEstimationPercentile = 50.0; |
| 9 const double kDrawDurationEstimationPercentile = 100.0; | 9 const double kDrawDurationEstimationPercentile = 100.0; |
| 10 const int kDrawDurationEstimatePaddingInMicroseconds = 0; | 10 const int kDrawDurationEstimatePaddingInMicroseconds = 0; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const { | 35 base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const { |
| 36 return commit_to_activate_duration_history_.Percentile( | 36 return commit_to_activate_duration_history_.Percentile( |
| 37 kCommitAndActivationDurationEstimationPercentile); | 37 kCommitAndActivationDurationEstimationPercentile); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void ProxyTimingHistory::DidBeginMainFrame() { | 40 void ProxyTimingHistory::DidBeginMainFrame() { |
| 41 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow(); | 41 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ProxyTimingHistory::DidCommit() { | 44 base::TimeDelta ProxyTimingHistory::DidCommit() { |
| 45 commit_complete_time_ = base::TimeTicks::HighResNow(); | 45 commit_complete_time_ = base::TimeTicks::HighResNow(); |
| 46 base::TimeDelta begin_main_frame_to_commit_duration = |
| 47 commit_complete_time_ - begin_main_frame_sent_time_; |
| 46 begin_main_frame_to_commit_duration_history_.InsertSample( | 48 begin_main_frame_to_commit_duration_history_.InsertSample( |
| 47 commit_complete_time_ - begin_main_frame_sent_time_); | 49 begin_main_frame_to_commit_duration); |
| 50 return begin_main_frame_to_commit_duration; |
| 48 } | 51 } |
| 49 | 52 |
| 50 void ProxyTimingHistory::DidActivatePendingTree() { | 53 base::TimeDelta ProxyTimingHistory::DidActivatePendingTree() { |
| 54 base::TimeDelta commit_to_activate_duration = |
| 55 base::TimeTicks::HighResNow() - commit_complete_time_; |
| 51 commit_to_activate_duration_history_.InsertSample( | 56 commit_to_activate_duration_history_.InsertSample( |
| 52 base::TimeTicks::HighResNow() - commit_complete_time_); | 57 commit_to_activate_duration); |
| 58 return commit_to_activate_duration; |
| 53 } | 59 } |
| 54 | 60 |
| 55 void ProxyTimingHistory::DidStartDrawing() { | 61 void ProxyTimingHistory::DidStartDrawing() { |
| 56 start_draw_time_ = base::TimeTicks::HighResNow(); | 62 start_draw_time_ = base::TimeTicks::HighResNow(); |
| 57 } | 63 } |
| 58 | 64 |
| 59 base::TimeDelta ProxyTimingHistory::DidFinishDrawing() { | 65 base::TimeDelta ProxyTimingHistory::DidFinishDrawing() { |
| 60 base::TimeDelta draw_duration = | 66 base::TimeDelta draw_duration = |
| 61 base::TimeTicks::HighResNow() - start_draw_time_; | 67 base::TimeTicks::HighResNow() - start_draw_time_; |
| 62 draw_duration_history_.InsertSample(draw_duration); | 68 draw_duration_history_.InsertSample(draw_duration); |
| 63 return draw_duration; | 69 return draw_duration; |
| 64 } | 70 } |
| 65 | 71 |
| 66 } // namespace cc | 72 } // namespace cc |
| OLD | NEW |