Commit bca35e18 authored by brianderson's avatar brianderson Committed by Commit bot

cc: Add trace events to track main thread latency mode

This will make easy to tell when the main thread is
in a high latency mode without having to infer based
on the surrounding context.

BUG=none

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

Cr-Commit-Position: refs/heads/master@{#297110}
parent 76577a68
...@@ -516,7 +516,17 @@ void Scheduler::PostBeginRetroFrameIfNeeded() { ...@@ -516,7 +516,17 @@ void Scheduler::PostBeginRetroFrameIfNeeded() {
// for a BeginMainFrame+activation to complete before it times out and draws // for a BeginMainFrame+activation to complete before it times out and draws
// any asynchronous animation and scroll/pinch updates. // any asynchronous animation and scroll/pinch updates.
void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
TRACE_EVENT1("cc", "Scheduler::BeginImplFrame", "args", args.AsValue()); bool main_thread_is_in_high_latency_mode =
state_machine_.MainThreadIsInHighLatencyMode();
TRACE_EVENT2("cc",
"Scheduler::BeginImplFrame",
"args",
args.AsValue(),
"main_thread_is_high_latency",
main_thread_is_in_high_latency_mode);
TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
"MainThreadLatency",
main_thread_is_in_high_latency_mode);
DCHECK_EQ(state_machine_.begin_impl_frame_state(), DCHECK_EQ(state_machine_.begin_impl_frame_state(),
SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
DCHECK(state_machine_.HasInitializedOutputSurface()); DCHECK(state_machine_.HasInitializedOutputSurface());
...@@ -528,7 +538,7 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { ...@@ -528,7 +538,7 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) {
begin_impl_frame_args_.deadline -= draw_duration_estimate; begin_impl_frame_args_.deadline -= draw_duration_estimate;
if (!state_machine_.impl_latency_takes_priority() && if (!state_machine_.impl_latency_takes_priority() &&
state_machine_.MainThreadIsInHighLatencyMode() && main_thread_is_in_high_latency_mode &&
CanCommitAndActivateBeforeDeadline()) { CanCommitAndActivateBeforeDeadline()) {
state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); state_machine_.SetSkipNextBeginMainFrameToReduceLatency();
} }
......
...@@ -703,6 +703,9 @@ void SchedulerStateMachine::UpdateStateOnManageTiles() { ...@@ -703,6 +703,9 @@ void SchedulerStateMachine::UpdateStateOnManageTiles() {
} }
void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() {
TRACE_EVENT_INSTANT0("cc",
"Scheduler: SkipNextBeginMainFrameToReduceLatency",
TRACE_EVENT_SCOPE_THREAD);
skip_next_begin_main_frame_to_reduce_latency_ = true; skip_next_begin_main_frame_to_reduce_latency_ = true;
} }
......
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