Bug 38837 - Reduce power consumption: timers must end eventually
Summary: Reduce power consumption: timers must end eventually
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp, topicDebug
Depends on:
Blocks:
 
Reported: 2011-06-30 09:25 UTC by Björn Michaelsen
Modified: 2021-04-04 05:10 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
here's a patch to output "TICK" every time a timer timesout (465 bytes, text/plain)
2012-04-13 05:48 UTC, Caolán McNamara
Details
better debugging patch (1.25 KB, patch)
2012-12-05 15:31 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-06-30 09:25:26 UTC
Reduce power consumption: timers must end eventually

Background: We have a lot of timers, which constantly fire endlessly once started (calc has a particularly nasty one). So we chew up battery life on laptops when we're idling. When we're idle we should, after a short enough time, actually go idle and not wake up the laptop constantly. That means removing any leaked timers properly. This is a matter of tracking pending timers, and verifying that they are sensible, adding some infrastructure to help with this would be good too. See #i106485.

Skills: building, C++
Comment 1 Aldo Román Nureña 2012-04-12 18:39:30 UTC
I'm sorry if i'm a newbie here, but I dont get it about "timers" and what they do. Any trail?
Comment 2 Caolán McNamara 2012-04-13 05:48:01 UTC
Created attachment 59907 [details]
here's a patch to output "TICK" every time a timer timesout

The problem is basically for battery life on e.g. a laptop. Ideally if office is open on a laptop and you're not doing anything with it you don't want the office to be running constantly waking up your processor and eating battery life if it has no work to do.

This commit http://cgit.freedesktop.org/libreoffice/core/commit/?id=388486a510c8f5b04132a614fa5f2c330d229248 and this description https://issues.apache.org/ooo/show_bug.cgi?id=106487#c0 is a good example of what I mean, i.e. changed "always running a timer to layout equations" to "run the timer to layout equations only when the equation has changed"
Comment 3 Florian Reisinger 2012-05-18 09:49:30 UTC
Deleted "Easyhack" from summary.
Comment 4 Caolán McNamara 2012-12-05 15:31:17 UTC
Created attachment 71031 [details]
better debugging patch
Comment 5 Not Assigned 2012-12-20 11:25:01 UTC
pkoroau pkoroau committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7a5272dc29c6efdaa99f97a627e6d9b695ae32f6

fdo#38837: Timers must end eventually [Writer idle timer]



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Björn Michaelsen 2013-10-04 18:46:12 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 7 Janit Anjaria 2013-12-22 18:29:09 UTC
Is there still some scope on this bug where i can work..??because it sounds like an interesting bug but it would be great if someone would help me with the same. :)
Comment 8 Björn Michaelsen 2015-01-02 22:35:19 UTC
The change:

https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=7a5272dc29c6efdaa99f97a627e6d9b695ae32f6;hp=4241ef2325d803914e9c29d8d6ec0e7c49f6996c

done for this issue caused regression fdo#73165. Might need a close look, if the change is worth the regression (or if the regression can be healed).
Comment 9 Commit Notification 2015-02-26 16:01:16 UTC
Ashod Nakashian committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c57213764b387dddad946e78145cea607ca9f460

tdf#38837 Reduce power consumption by minimizing idle timers

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2015-02-26 16:03:42 UTC
Ashod Nakashian committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2304bce084a87cdf2e0711f8408b53036f1d5d37&h=libreoffice-4-4

tdf#38837 Reduce power consumption by minimizing idle timers

It will be available in 4.4.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2015-07-15 07:48:11 UTC
Ashod Nakashian committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b0fde7a912ff3aa370496802f20895b1158b072c

tdf#38837 Reduce power consumption by minimizing idle timers

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Jean-Baptiste Faure 2015-07-15 09:53:16 UTC
Seems to have a positive effect on bug 91870. Will do more check.

Is it planed to backport last commit (comment #11) to 5.0 ?

Best regards. JBF
Comment 13 Commit Notification 2015-07-16 11:53:38 UTC
Ashod Nakashian committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2113ee5491fa823b14b6c25b6d9a4f170452f9d3&h=libreoffice-5-0

tdf#38837 Reduce power consumption by minimizing idle timers

It will be available in 5.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 14 tommy27 2015-07-16 12:33:59 UTC
@Ashod
thanks for pushing it to 5.0.1 

I think this deserves to be listed in the 5.0 release notes if you will be able to push it to 5.0.0 as well (another RC is scheduled before final release in august)

https://wiki.documentfoundation.org/ReleaseNotes/5.0
Comment 15 tommy27 2015-07-16 12:35:27 UTC
what about the status of the issue? is the work done (so FIXED) or it has do be tweaked again to solve residual issues (leaving it as NEW)?
Comment 16 Ashod Nakashian 2015-07-16 15:13:11 UTC
(In reply to tommy27 from comment #15)
> what about the status of the issue? is the work done (so FIXED) or it has do
> be tweaked again to solve residual issues (leaving it as NEW)?

It's hard to tell if this concludes all cases, but there is one case that I'd like to investigate further.

For now, I don't have any known cases to fix. We close it as fixed and reopen for new cases, or leave it open as a general high idle cpu usage cases.
Comment 17 tommy27 2015-07-16 15:57:26 UTC
I'd like to see it tagged FIXED and open a follow-up new report in case of remaining issues.

anyway let's hear Bjorn's opinion about this.
Comment 18 Björn Michaelsen 2015-07-16 16:06:13 UTC
(In reply to tommy27 from comment #17)
> anyway let's hear Bjorn's opinion about this.

No opinion at all on this. I didnt write this EasyHack, just copied it over from the wiki.

@Michael: I assume this is yours, can it be killed?
Comment 19 Caolán McNamara 2015-07-16 16:21:07 UTC
This was my "easy" hack. I suspect that *calc* still has a timer that never ends. But if some one double checks that and finds that calc doesn't have an endless timer then this can be closed, and if calc does have one and writer doesn't then this could be renamed to "writer timers must end eventually" and closed off and a new one for the calc opened up in order to keep things tight and on-focus given the no of comments this now has
Comment 20 Jean-Baptiste Faure 2015-07-17 04:42:29 UTC
I guess there is some remaining timer related to automatic spelling (Shift+F7). Indeed with a large document opened while automatic spelling is disabled, I see CPU consumption even if I do nothing with the document. Then if I enable automatic spelling then disable it again, the CPU consumption of LO falls to zero.

Best regards. JBF
Comment 21 Ashod Nakashian 2015-07-19 17:50:07 UTC
(In reply to Jean-Baptiste Faure from comment #20)
> I guess there is some remaining timer related to automatic spelling

I've submitted a fix for this as part of tdf#92036.
Comment 22 Robinson Tryon (qubit) 2015-12-14 06:31:46 UTC Comment hidden (obsolete)
Comment 23 Robinson Tryon (qubit) 2016-02-18 14:51:27 UTC Comment hidden (obsolete)
Comment 24 jani 2016-05-05 13:34:28 UTC
seems solved