scheduler: Disable expensive timers during main thread user input
Previously, if the user was interacting with the device, we
would only allow timers to run during idle periods. Turns
out this strategy wasn't effective with workloads with very
expensive timers. This is because even the occasional idle
period is enough to let a long running timer execute,
potentially causing jank.
This patch changes the heuristic to be based on the
expected run time of each timer task. The estimation is
based on historical run times. If we have seen user input
recently and the main thread is on the critical path, we
now disable timer tasks completely for the duration of the
interaction.
As a follow up we may want to consider doing similar
estimation for loading tasks, as well as estimating
workloads from different domains separately.
BUG=523406
Review URL: https://codereview.chromium.org/
1303353003
Cr-Commit-Position: refs/heads/master@{#344858}