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() {
return make_scoped_ptr(new PaintTimeCounter());
}
PaintTimeCounter::PaintTimeCounter()
: can_save_paint_time_delta_(false) {
PaintTimeCounter::PaintTimeCounter() {
}
void PaintTimeCounter::SavePaintTime(const base::TimeDelta& total_paint_time) {
if (can_save_paint_time_delta_) {
base::TimeDelta paint_time = total_paint_time - last_total_paint_time_;
void PaintTimeCounter::SavePaintTime(const base::TimeDelta& 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,
......@@ -45,7 +38,6 @@ void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
void PaintTimeCounter::ClearHistory() {
ring_buffer_.Clear();
can_save_paint_time_delta_ = false;
}
} // namespace cc
......@@ -36,8 +36,6 @@ class PaintTimeCounter {
PaintTimeCounter();
RingBufferType ring_buffer_;
base::TimeDelta last_total_paint_time_;
bool can_save_paint_time_delta_;
DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter);
};
......
......@@ -28,6 +28,10 @@ void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) {
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()
: painted_pixel_count(0), recorded_pixel_count(0) {
}
......
......@@ -28,6 +28,8 @@ struct CC_EXPORT RenderingStats {
void Add(const TimeDeltaList& other);
base::TimeDelta GetLastTimeDelta() const;
private:
std::list<base::TimeDelta> values;
};
......
......@@ -565,13 +565,8 @@ SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay(
"%.1f-%.1f", paint_time_graph_.min, paint_time_graph_.max);
paint.setColor(DebugColors::PaintTimeDisplayTextAndGraphColor());
DrawText(canvas,
&paint,
"Page paint time (ms)",
SkPaint::kLeft_Align,
kFontHeight,
text_bounds.left(),
text_bounds.bottom());
DrawText(canvas, &paint, "Compositor frame time (ms)", SkPaint::kLeft_Align,
kFontHeight, text_bounds.left(), text_bounds.bottom());
DrawText(canvas,
&paint,
value_text,
......
......@@ -1874,9 +1874,11 @@ void LayerTreeHostImpl::ActivateSyncTree() {
if (debug_state_.continuous_painting) {
const RenderingStats& stats =
rendering_stats_instrumentation_->GetRenderingStats();
paint_time_counter_->SavePaintTime(stats.main_stats.paint_time +
stats.main_stats.record_time +
stats.impl_stats.rasterize_time);
// TODO(hendrikw): This requires a different metric when we commit directly
// to the active tree. See crbug.com/429311.
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())
......
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