Open Bug 1651168 Opened 4 years ago Updated 2 years ago

Build a more sophisticated idle task system

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

Performance Impact none

People

(Reporter: alexical, Unassigned)

References

Details

(Keywords: perf:responsiveness, perf:startup)

Currently we have two very different idle systems. 1) systems based on idleDispatchToMainThread, and 2) nsIIdleService. 1 will dispatch anything when there is even a small amount of time where the main thread isn't doing anything else, and 2 will dispatch based on whether the user is idle or not.

These two systems are insufficient. 1 is useless for scheduling things which might use a lot of disk IO time, since the main thread being idle for a few milliseconds is irrelevant to the scale of disk work. 2 is problematic because if you want to have a sufficient time scale to be confident that the system really isn't doing much work, you may end up with a callback that never gets executed, because the user is always doing something (like even moving their mouse).

It would be ideal if we had a system which could track the usage of various resources on the system - CPU, disk, and network come to mind, and allows us to schedule tasks which will execute when those resources are in low demand.

Today we already have the CPUUsageWatcher running on Nightly, which the BackgroundHangMonitor uses to check if external CPU usage is high and thus might be the cause of a particular browser hang. We could probably adapt this and extend it with storage / network measures to get what we want.

Whiteboard: [fxperf] → [fxperf:p2]
Performance Impact: --- → ?
Whiteboard: [fxperf:p2]
Performance Impact: ? → -
You need to log in before you can comment on or make changes to this bug.