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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/proxy_timing_history.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/trees/proxy_timing_history.h"
6
7 const size_t kDurationHistorySize = 60;
8 const double kCommitAndActivationDurationEstimationPercentile = 50.0;
9 const double kDrawDurationEstimationPercentile = 100.0;
10 const int kDrawDurationEstimatePaddingInMicroseconds = 0;
11
12 namespace cc {
13
14 ProxyTimingHistory::ProxyTimingHistory()
15 : draw_duration_history_(kDurationHistorySize),
16 begin_main_frame_to_commit_duration_history_(kDurationHistorySize),
17 commit_to_activate_duration_history_(kDurationHistorySize) {}
18
19 ProxyTimingHistory::~ProxyTimingHistory() {}
20
21 base::TimeDelta ProxyTimingHistory::DrawDurationEstimate() const {
22 base::TimeDelta historical_estimate =
23 draw_duration_history_.Percentile(kDrawDurationEstimationPercentile);
24 base::TimeDelta padding = base::TimeDelta::FromMicroseconds(
25 kDrawDurationEstimatePaddingInMicroseconds);
26 return historical_estimate + padding;
27 }
28
29 base::TimeDelta ProxyTimingHistory::BeginMainFrameToCommitDurationEstimate()
30 const {
31 return begin_main_frame_to_commit_duration_history_.Percentile(
32 kCommitAndActivationDurationEstimationPercentile);
33 }
34
35 base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const {
36 return commit_to_activate_duration_history_.Percentile(
37 kCommitAndActivationDurationEstimationPercentile);
38 }
39
40 void ProxyTimingHistory::DidBeginMainFrame() {
41 begin_main_frame_sent_time_ = base::TimeTicks::HighResNow();
42 }
43
44 void ProxyTimingHistory::DidCommit() {
45 commit_complete_time_ = base::TimeTicks::HighResNow();
46 begin_main_frame_to_commit_duration_history_.InsertSample(
47 commit_complete_time_ - begin_main_frame_sent_time_);
48 }
49
50 void ProxyTimingHistory::DidActivatePendingTree() {
51 commit_to_activate_duration_history_.InsertSample(
52 base::TimeTicks::HighResNow() - commit_complete_time_);
53 }
54
55 void ProxyTimingHistory::DidStartDrawing() {
56 start_draw_time_ = base::TimeTicks::HighResNow();
57 }
58
59 base::TimeDelta ProxyTimingHistory::DidFinishDrawing() {
60 base::TimeDelta draw_duration =
61 base::TimeTicks::HighResNow() - start_draw_time_;
62 draw_duration_history_.InsertSample(draw_duration);
63 return draw_duration;
64 }
65
66 } // namespace cc
OLDNEW
« 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