| Index: cc/scheduler/compositor_timing_history.cc
|
| diff --git a/cc/scheduler/compositor_timing_history.cc b/cc/scheduler/compositor_timing_history.cc
|
| index f546062235dff94243504d07b3f5781bd36d3c4c..ab1cd044ec03898063e264f82e69677a149d50c3 100644
|
| --- a/cc/scheduler/compositor_timing_history.cc
|
| +++ b/cc/scheduler/compositor_timing_history.cc
|
| @@ -50,6 +50,9 @@ class CompositorTimingHistory::UMAReporter {
|
| base::TimeDelta estimate,
|
| bool affects_estimate) = 0;
|
| virtual void AddSwapToAckLatency(base::TimeDelta duration) = 0;
|
| +
|
| + // Synchronization measurements
|
| + virtual void AddMainAndImplFrameTimeDelta(base::TimeDelta delta) = 0;
|
| };
|
|
|
| namespace {
|
| @@ -217,6 +220,11 @@ class RendererUMAReporter : public CompositorTimingHistory::UMAReporter {
|
| UMA_HISTOGRAM_CUSTOM_TIMES_MICROS("Scheduling.Renderer.SwapToAckLatency",
|
| duration);
|
| }
|
| +
|
| + void AddMainAndImplFrameTimeDelta(base::TimeDelta delta) override {
|
| + UMA_HISTOGRAM_CUSTOM_TIMES_MICROS(
|
| + "Scheduling.Renderer.MainAndImplFrameTimeDelta", delta);
|
| + }
|
| };
|
|
|
| class BrowserUMAReporter : public CompositorTimingHistory::UMAReporter {
|
| @@ -298,6 +306,11 @@ class BrowserUMAReporter : public CompositorTimingHistory::UMAReporter {
|
| UMA_HISTOGRAM_CUSTOM_TIMES_MICROS("Scheduling.Browser.SwapToAckLatency",
|
| duration);
|
| }
|
| +
|
| + void AddMainAndImplFrameTimeDelta(base::TimeDelta delta) override {
|
| + UMA_HISTOGRAM_CUSTOM_TIMES_MICROS(
|
| + "Scheduling.Browser.MainAndImplFrameTimeDelta", delta);
|
| + }
|
| };
|
|
|
| class NullUMAReporter : public CompositorTimingHistory::UMAReporter {
|
| @@ -332,14 +345,18 @@ class NullUMAReporter : public CompositorTimingHistory::UMAReporter {
|
| base::TimeDelta estimate,
|
| bool affects_estimate) override {}
|
| void AddSwapToAckLatency(base::TimeDelta duration) override {}
|
| + void AddMainAndImplFrameTimeDelta(base::TimeDelta delta) override {}
|
| };
|
|
|
| } // namespace
|
|
|
| CompositorTimingHistory::CompositorTimingHistory(
|
| + bool using_synchronous_renderer_compositor,
|
| UMACategory uma_category,
|
| RenderingStatsInstrumentation* rendering_stats_instrumentation)
|
| - : enabled_(false),
|
| + : using_synchronous_renderer_compositor_(
|
| + using_synchronous_renderer_compositor),
|
| + enabled_(false),
|
| did_send_begin_main_frame_(false),
|
| begin_main_frame_needed_continuously_(false),
|
| begin_main_frame_committing_continuously_(false),
|
| @@ -478,6 +495,12 @@ base::TimeDelta CompositorTimingHistory::DrawDurationEstimate() const {
|
| return draw_duration_history_.Percentile(kDrawEstimationPercentile);
|
| }
|
|
|
| +void CompositorTimingHistory::DidCreateAndInitializeOutputSurface() {
|
| + // After we get a new output surface, we won't get a spurious
|
| + // swap ack from the old output surface.
|
| + swap_start_time_ = base::TimeTicks();
|
| +}
|
| +
|
| void CompositorTimingHistory::WillBeginImplFrame(
|
| bool new_active_tree_is_likely) {
|
| // The check for whether a BeginMainFrame was sent anytime between two
|
| @@ -505,10 +528,15 @@ void CompositorTimingHistory::BeginImplFrameNotExpectedSoon() {
|
| SetCompositorDrawingContinuously(false);
|
| }
|
|
|
| -void CompositorTimingHistory::WillBeginMainFrame(bool on_critical_path) {
|
| +void CompositorTimingHistory::WillBeginMainFrame(
|
| + bool on_critical_path,
|
| + base::TimeTicks main_frame_time) {
|
| DCHECK_EQ(base::TimeTicks(), begin_main_frame_sent_time_);
|
| + DCHECK_EQ(base::TimeTicks(), begin_main_frame_frame_time_);
|
| +
|
| begin_main_frame_on_critical_path_ = on_critical_path;
|
| begin_main_frame_sent_time_ = Now();
|
| + begin_main_frame_frame_time_ = main_frame_time;
|
|
|
| did_send_begin_main_frame_ = true;
|
| SetBeginMainFrameNeededContinuously(true);
|
| @@ -524,11 +552,15 @@ void CompositorTimingHistory::BeginMainFrameStarted(
|
| void CompositorTimingHistory::BeginMainFrameAborted() {
|
| SetBeginMainFrameCommittingContinuously(false);
|
| DidBeginMainFrame();
|
| + begin_main_frame_frame_time_ = base::TimeTicks();
|
| }
|
|
|
| void CompositorTimingHistory::DidCommit() {
|
| + DCHECK_EQ(base::TimeTicks(), pending_tree_main_frame_time_);
|
| SetBeginMainFrameCommittingContinuously(true);
|
| DidBeginMainFrame();
|
| + pending_tree_main_frame_time_ = begin_main_frame_frame_time_;
|
| + begin_main_frame_frame_time_ = base::TimeTicks();
|
| }
|
|
|
| void CompositorTimingHistory::DidBeginMainFrame() {
|
| @@ -666,7 +698,13 @@ void CompositorTimingHistory::DidActivate() {
|
| if (enabled_)
|
| activate_duration_history_.InsertSample(activate_duration);
|
|
|
| + // The synchronous compositor doesn't necessarily draw every new active tree.
|
| + if (!using_synchronous_renderer_compositor_)
|
| + DCHECK_EQ(base::TimeTicks(), active_tree_main_frame_time_);
|
| + active_tree_main_frame_time_ = pending_tree_main_frame_time_;
|
| +
|
| activate_start_time_ = base::TimeTicks();
|
| + pending_tree_main_frame_time_ = base::TimeTicks();
|
| }
|
|
|
| void CompositorTimingHistory::WillDraw() {
|
| @@ -674,7 +712,13 @@ void CompositorTimingHistory::WillDraw() {
|
| draw_start_time_ = Now();
|
| }
|
|
|
| -void CompositorTimingHistory::DidDraw(bool used_new_active_tree) {
|
| +void CompositorTimingHistory::DrawAborted() {
|
| + active_tree_main_frame_time_ = base::TimeTicks();
|
| +}
|
| +
|
| +void CompositorTimingHistory::DidDraw(bool used_new_active_tree,
|
| + bool main_thread_missed_last_deadline,
|
| + base::TimeTicks impl_frame_time) {
|
| DCHECK_NE(base::TimeTicks(), draw_start_time_);
|
| base::TimeTicks draw_end_time = Now();
|
| base::TimeDelta draw_duration = draw_end_time - draw_start_time_;
|
| @@ -699,13 +743,26 @@ void CompositorTimingHistory::DidDraw(bool used_new_active_tree) {
|
| }
|
| draw_end_time_prev_ = draw_end_time;
|
|
|
| - if (begin_main_frame_committing_continuously_ && used_new_active_tree) {
|
| - if (!new_active_tree_draw_end_time_prev_.is_null()) {
|
| - base::TimeDelta draw_interval =
|
| - draw_end_time - new_active_tree_draw_end_time_prev_;
|
| - uma_reporter_->AddCommitInterval(draw_interval);
|
| + if (used_new_active_tree) {
|
| + DCHECK_NE(base::TimeTicks(), active_tree_main_frame_time_);
|
| + base::TimeDelta main_and_impl_delta =
|
| + impl_frame_time - active_tree_main_frame_time_;
|
| + DCHECK_GE(main_and_impl_delta, base::TimeDelta());
|
| + if (!using_synchronous_renderer_compositor_) {
|
| + DCHECK_EQ(main_thread_missed_last_deadline,
|
| + !main_and_impl_delta.is_zero());
|
| + }
|
| + uma_reporter_->AddMainAndImplFrameTimeDelta(main_and_impl_delta);
|
| + active_tree_main_frame_time_ = base::TimeTicks();
|
| +
|
| + if (begin_main_frame_committing_continuously_) {
|
| + if (!new_active_tree_draw_end_time_prev_.is_null()) {
|
| + base::TimeDelta draw_interval =
|
| + draw_end_time - new_active_tree_draw_end_time_prev_;
|
| + uma_reporter_->AddCommitInterval(draw_interval);
|
| + }
|
| + new_active_tree_draw_end_time_prev_ = draw_end_time;
|
| }
|
| - new_active_tree_draw_end_time_prev_ = draw_end_time;
|
| }
|
|
|
| draw_start_time_ = base::TimeTicks();
|
| @@ -723,8 +780,4 @@ void CompositorTimingHistory::DidSwapBuffersComplete() {
|
| swap_start_time_ = base::TimeTicks();
|
| }
|
|
|
| -void CompositorTimingHistory::DidSwapBuffersReset() {
|
| - swap_start_time_ = base::TimeTicks();
|
| -}
|
| -
|
| } // namespace cc
|
|
|