Commit e161b5e9 authored by Hailey Wang's avatar Hailey Wang Committed by Commit Bot

Adding trace event for long draw intervals

Used to analyze traces uploaded via Slow Reports when draw intervals
above the 99th percentile threshold are detected.

Bug: 1055890
Change-Id: I64c97de8ffcd9d288f5c71a85bdd79789f704d66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083431Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Hailey Wang <haileywang@google.com>
Cr-Commit-Position: refs/heads/master@{#749348}
parent ba01490b
......@@ -56,6 +56,15 @@ class CompositorTimingHistory::UMAReporter {
namespace {
// Used to generate a unique id when emitting the "Long Draw Interval" trace
// event.
int g_num_long_draw_intervals = 0;
// The threshold to emit a trace event is the 99th percentile
// of the histogram on Windows Stable as of Feb 26th, 2020.
constexpr base::TimeDelta kDrawIntervalTraceThreshold =
base::TimeDelta::FromMicroseconds(34478);
// Using the 90th percentile will disable latency recovery
// if we are missing the deadline approximately ~6 times per
// second.
......@@ -880,6 +889,17 @@ void CompositorTimingHistory::DidDraw(bool used_new_active_tree,
if (!draw_end_time_prev_.is_null()) {
base::TimeDelta draw_interval = draw_end_time - draw_end_time_prev_;
uma_reporter_->AddDrawInterval(draw_interval);
// Emit a trace event to highlight a long time lapse between the draw times
// of back-to-back BeginImplFrames.
if (draw_interval > kDrawIntervalTraceThreshold) {
TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(
"latency", "Long Draw Interval",
TRACE_ID_LOCAL(g_num_long_draw_intervals), draw_start_time_);
TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(
"latency", "Long Draw Interval",
TRACE_ID_LOCAL(g_num_long_draw_intervals), draw_end_time);
g_num_long_draw_intervals++;
}
if (composited_animations_count > 0 &&
previous_frame_had_composited_animations_)
uma_reporter_->AddDrawIntervalWithCompositedAnimations(draw_interval);
......
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