Commit 06b77c02 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[Jank]: Add metadata on long input delay.

Metadata is applied on past samples for the stack sampling profiler
once a long input delay is detected.

As part of an investigation on jank (and more specifically long
input delay)
https://docs.google.com/document/d/1YTpnc7o8XH1KioJpPhWoZvi4Zkpo7cezDrGjQrKZmlQ/edit#heading=h.iohxee36df7p
we're looking into UMA stack sampling profiler data.
Currently, we can only detect jank caused by stalled stacks.
Annotating stack frames with (long) input event will allow us
to analyze "running" jank.

Change-Id: I7914aebf4e14504b400f241d827bda56b6f84db0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2172214Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766465}
parent 4ba46f62
......@@ -12,6 +12,7 @@ include_rules = [
"+base/memory/scoped_refptr.h",
"+base/metrics/field_trial_params.h",
"+base/numerics/ranges.h",
"+base/profiler/sample_metadata.h",
"+base/strings/stringprintf.h",
"+base/synchronization/waitable_event.h",
"+base/task/sequence_manager/task_time_observer.h",
......
......@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/core/loader/interactive_detector.h"
#include "base/metrics/histogram_macros.h"
#include "base/profiler/sample_metadata.h"
#include "base/time/default_tick_clock.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
......@@ -19,7 +20,7 @@ namespace blink {
namespace {
// Used to generate a unique id when emitting the "Long Input Delay" trace
// event.
// event and metadata.
int g_num_long_input_events = 0;
// The threshold to emit the "Long Input Delay" trace event is the 99th
......@@ -251,6 +252,11 @@ void InteractiveDetector::HandleForInputDelay(
TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(
"latency", "Long Input Delay", TRACE_ID_LOCAL(g_num_long_input_events),
event_timestamp + delay);
// Apply metadata on stack samples.
base::ApplyMetadataToPastSamples(
event_timestamp, event_timestamp + delay,
"PageLoad.InteractiveTiming.LongInputDelay", g_num_long_input_events,
1);
g_num_long_input_events++;
}
......
......@@ -30,6 +30,7 @@ _CONFIG = [
# //base constructs that are allowed everywhere
'base::AdoptRef',
'base::ApplyMetadataToPastSamples',
'base::AutoReset',
'base::Contains',
'base::CreateSequencedTaskRunner',
......
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