Commit f1775271 authored by hendrikw's avatar hendrikw Committed by Commit bot

cc: Use commit to activation time in repaint HUD

In an effort to remove rasterize_time from the impl stats, I'm using
commit_to_activate_duration in its place, which should give a better
indication of the commit to activation time (raster + management time).

BUG=

Review URL: https://codereview.chromium.org/689503002

Cr-Commit-Position: refs/heads/master@{#302633}
parent c41e2a21
...@@ -11,18 +11,11 @@ scoped_ptr<PaintTimeCounter> PaintTimeCounter::Create() { ...@@ -11,18 +11,11 @@ scoped_ptr<PaintTimeCounter> PaintTimeCounter::Create() {
return make_scoped_ptr(new PaintTimeCounter()); return make_scoped_ptr(new PaintTimeCounter());
} }
PaintTimeCounter::PaintTimeCounter() PaintTimeCounter::PaintTimeCounter() {
: can_save_paint_time_delta_(false) {
} }
void PaintTimeCounter::SavePaintTime(const base::TimeDelta& total_paint_time) { void PaintTimeCounter::SavePaintTime(const base::TimeDelta& paint_time) {
if (can_save_paint_time_delta_) { ring_buffer_.SaveToBuffer(paint_time);
base::TimeDelta paint_time = total_paint_time - last_total_paint_time_;
ring_buffer_.SaveToBuffer(paint_time);
}
last_total_paint_time_ = total_paint_time;
can_save_paint_time_delta_ = true;
} }
void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min, void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
...@@ -45,7 +38,6 @@ void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min, ...@@ -45,7 +38,6 @@ void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
void PaintTimeCounter::ClearHistory() { void PaintTimeCounter::ClearHistory() {
ring_buffer_.Clear(); ring_buffer_.Clear();
can_save_paint_time_delta_ = false;
} }
} // namespace cc } // namespace cc
...@@ -36,8 +36,6 @@ class PaintTimeCounter { ...@@ -36,8 +36,6 @@ class PaintTimeCounter {
PaintTimeCounter(); PaintTimeCounter();
RingBufferType ring_buffer_; RingBufferType ring_buffer_;
base::TimeDelta last_total_paint_time_;
bool can_save_paint_time_delta_;
DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter); DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter);
}; };
......
...@@ -28,6 +28,10 @@ void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) { ...@@ -28,6 +28,10 @@ void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) {
values.insert(values.end(), other.values.begin(), other.values.end()); values.insert(values.end(), other.values.begin(), other.values.end());
} }
base::TimeDelta RenderingStats::TimeDeltaList::GetLastTimeDelta() const {
return values.empty() ? base::TimeDelta() : values.back();
}
RenderingStats::MainThreadRenderingStats::MainThreadRenderingStats() RenderingStats::MainThreadRenderingStats::MainThreadRenderingStats()
: painted_pixel_count(0), recorded_pixel_count(0) { : painted_pixel_count(0), recorded_pixel_count(0) {
} }
......
...@@ -28,6 +28,8 @@ struct CC_EXPORT RenderingStats { ...@@ -28,6 +28,8 @@ struct CC_EXPORT RenderingStats {
void Add(const TimeDeltaList& other); void Add(const TimeDeltaList& other);
base::TimeDelta GetLastTimeDelta() const;
private: private:
std::list<base::TimeDelta> values; std::list<base::TimeDelta> values;
}; };
......
...@@ -565,13 +565,8 @@ SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay( ...@@ -565,13 +565,8 @@ SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay(
"%.1f-%.1f", paint_time_graph_.min, paint_time_graph_.max); "%.1f-%.1f", paint_time_graph_.min, paint_time_graph_.max);
paint.setColor(DebugColors::PaintTimeDisplayTextAndGraphColor()); paint.setColor(DebugColors::PaintTimeDisplayTextAndGraphColor());
DrawText(canvas, DrawText(canvas, &paint, "Compositor frame time (ms)", SkPaint::kLeft_Align,
&paint, kFontHeight, text_bounds.left(), text_bounds.bottom());
"Page paint time (ms)",
SkPaint::kLeft_Align,
kFontHeight,
text_bounds.left(),
text_bounds.bottom());
DrawText(canvas, DrawText(canvas,
&paint, &paint,
value_text, value_text,
......
...@@ -1874,9 +1874,11 @@ void LayerTreeHostImpl::ActivateSyncTree() { ...@@ -1874,9 +1874,11 @@ void LayerTreeHostImpl::ActivateSyncTree() {
if (debug_state_.continuous_painting) { if (debug_state_.continuous_painting) {
const RenderingStats& stats = const RenderingStats& stats =
rendering_stats_instrumentation_->GetRenderingStats(); rendering_stats_instrumentation_->GetRenderingStats();
paint_time_counter_->SavePaintTime(stats.main_stats.paint_time + // TODO(hendrikw): This requires a different metric when we commit directly
stats.main_stats.record_time + // to the active tree. See crbug.com/429311.
stats.impl_stats.rasterize_time); paint_time_counter_->SavePaintTime(
stats.impl_stats.commit_to_activate_duration.GetLastTimeDelta() +
stats.impl_stats.draw_duration.GetLastTimeDelta());
} }
if (time_source_client_adapter_ && time_source_client_adapter_->Active()) if (time_source_client_adapter_ && time_source_client_adapter_->Active())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment