Description[scheduler]: Avoid waking up the scheduler to end long idle periods.
Reworks the IdleHandler logic to avoid waking the scheduler just to end idle
periods. The new approach avoids posting delayed tasks on the control queue
and instead registers the IdleHandler as a TaskObserver on the message loop,
and checks at the end of each task whether the idle period should end.
Also adds a SingleThreadIdleTaskRunner::Observer, which gets notified when
idle tasks are posted or run. The IdleHelper uses this to decide when to
restart a long-idle period or when to pause long idle period ticks (e.g., if
there are currently no idle tasks queued to be run).
This new model also allow better tracing of idle periods, and the async idle
period tracing code has been improved to use nestable async events, and to only
show "DeadlineOverrun" events if there is actually a idle task running.
Finally adds TRACE_EVENT_NESTABLE_ASYNC_BEGIN/END_WITH_TIMESTAMP0 to
trace_events.h which is required as part of this change.
BUG=485371, 493350
Committed: https://crrev.com/db151ad312913a65a1d4d7d795ca874f644142e0
Cr-Commit-Position: refs/heads/master@{#332414}
Patch Set 1 : #
Total comments: 40
Patch Set 2 : Rebased #Patch Set 3 : Review comments. #
Total comments: 11
Patch Set 4 : Review comments. #
Total comments: 8
Patch Set 5 : Fix tests and update for review. #
Total comments: 12
Patch Set 6 : Rebased #Patch Set 7 : Address review comments. #
Total comments: 2
Patch Set 8 : Fix ASAN and Windows #Patch Set 9 : Fix Win for realz hopefully... #Messages
Total messages: 41 (16 generated)
|