nsUserIdleService causes pointless CPU wake-ups every 5s
Categories
(Core :: Widget, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox111 | --- | fixed |
People
(Reporter: florian, Assigned: florian)
References
(Blocks 1 open bug)
Details
(Keywords: perf:resource-use, power)
Attachments
(2 files)
When Firefox is really idle and the user not touching the machine, the "nsUserIdleService::SetTimerExpiryIfBefore" runnable is the most frequent one that executes, every 5s.
Example profile: https://share.firefox.dev/3Pd4qkU
This behavior was implemented at https://searchfox.org/mozilla-central/rev/88792eff309001778cb2431f2a0ed92f8f3c258a/widget/nsUserIdleService.cpp#862-880 in bug 720493, apparently to workaround a bug that wasn't well understood at the time.
We should try and change that so that the idle service only causes wake-up if there's actually an observer that wants to be notified.
Comment 1•4 years ago
|
||
The severity field is not set for this bug.
:spohl, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 3•3 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 4•3 years ago
|
||
This changes the behavior in a few ways:
- the 'back' notification is now only fired when a new user event has been received by Firefox, rather than by any application on the entire system.
- the 'back' notification will fire immediately when Firefox receives a new event. Before the patch is was fired within 5s of the user returning on some plateforms (eg. Mac) and immediately on some other platforms that already called ResetIdleTimeout (windows, gtk, android). I'm not sure if these existing calls to ResetIdleTimeout are really needed, nor if they add significant overhead.
- when an idle observer has been notified of 'idle', it won't be notified again until Firefox receives events. Before the patch, if the user used other applications while Firefox was in the background, we would keep sending back and idle notifications to our idle observers. This behavior was probably initially intended when the nsUserIdleService was introduced to support the use case of instant messaging clients, but doesn't seem to match the expectations of the existing consumers of the service.
Depends on D166305
Comment 6•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/eab0a62da795
https://hg.mozilla.org/mozilla-central/rev/6c80af296399
Description
•