Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3938)

Unified Diff: cc/trees/proxy_timing_history.cc

Issue 154163005: cc: Abstract out proxy timing history (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile oops Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/proxy_timing_history.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/proxy_timing_history.cc
diff --git a/cc/trees/proxy_timing_history.cc b/cc/trees/proxy_timing_history.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0f42ff0aca8391eda3428be2dd1cf43a7f2c9a84
--- /dev/null
+++ b/cc/trees/proxy_timing_history.cc
@@ -0,0 +1,66 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/trees/proxy_timing_history.h"
+
+const size_t kDurationHistorySize = 60;
+const double kCommitAndActivationDurationEstimationPercentile = 50.0;
+const double kDrawDurationEstimationPercentile = 100.0;
+const int kDrawDurationEstimatePaddingInMicroseconds = 0;
+
+namespace cc {
+
+ProxyTimingHistory::ProxyTimingHistory()
+ : draw_duration_history_(kDurationHistorySize),
+ begin_main_frame_to_commit_duration_history_(kDurationHistorySize),
+ commit_to_activate_duration_history_(kDurationHistorySize) {}
+
+ProxyTimingHistory::~ProxyTimingHistory() {}
+
+base::TimeDelta ProxyTimingHistory::DrawDurationEstimate() const {
+ base::TimeDelta historical_estimate =
+ draw_duration_history_.Percentile(kDrawDurationEstimationPercentile);
+ base::TimeDelta padding = base::TimeDelta::FromMicroseconds(
+ kDrawDurationEstimatePaddingInMicroseconds);
+ return historical_estimate + padding;
+}
+
+base::TimeDelta ProxyTimingHistory::BeginMainFrameToCommitDurationEstimate()
+ const {
+ return begin_main_frame_to_commit_duration_history_.Percentile(
+ kCommitAndActivationDurationEstimationPercentile);
+}
+
+base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const {
+ return commit_to_activate_duration_history_.Percentile(
+ kCommitAndActivationDurationEstimationPercentile);
+}
+
+void ProxyTimingHistory::DidBeginMainFrame() {
+ begin_main_frame_sent_time_ = base::TimeTicks::HighResNow();
+}
+
+void ProxyTimingHistory::DidCommit() {
+ commit_complete_time_ = base::TimeTicks::HighResNow();
+ begin_main_frame_to_commit_duration_history_.InsertSample(
+ commit_complete_time_ - begin_main_frame_sent_time_);
+}
+
+void ProxyTimingHistory::DidActivatePendingTree() {
+ commit_to_activate_duration_history_.InsertSample(
+ base::TimeTicks::HighResNow() - commit_complete_time_);
+}
+
+void ProxyTimingHistory::DidStartDrawing() {
+ start_draw_time_ = base::TimeTicks::HighResNow();
+}
+
+base::TimeDelta ProxyTimingHistory::DidFinishDrawing() {
+ base::TimeDelta draw_duration =
+ base::TimeTicks::HighResNow() - start_draw_time_;
+ draw_duration_history_.InsertSample(draw_duration);
+ return draw_duration;
+}
+
+} // namespace cc
« no previous file with comments | « cc/trees/proxy_timing_history.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698