Bug 150389 - Akregator doesn't do "idle". Storage backend wakes up every 3 seconds :-(.
Summary: Akregator doesn't do "idle". Storage backend wakes up every 3 seconds :-(.
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: metakit plugin (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-01 22:37 UTC by Alan Jenkins
Modified: 2007-10-06 03:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Fix storage backend polling (3.27 KB, patch)
2007-10-01 22:45 UTC, Alan Jenkins
Details
Improved patch using QTimer::singleShot() (3.08 KB, patch)
2007-10-04 15:40 UTC, Eckhart Wörner
Details
Corrected version which takes feed storage changes into account (9.72 KB, patch)
2007-10-06 02:23 UTC, Eckhart Wörner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Jenkins 2007-10-01 22:37:08 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Unspecified Linux
OS:                Linux

Idle computers sleep to save power.  Sucky applications wake up idle computers for no reason, wasting power.  This is the wisdom of powertop[1].

Since I prefer to use non sucky applications, heres a patch which removes the storage backends charming habit of waking up every 3 seconds to see whether there are changes to commit to disk.  I preserve the behaviour of batching commits over 3 second intervals, and of making sure changes are commited within 3 seconds.  

Disclaimer: I'm not a KDE dev; it looks good to me but it who knows if it'll eat your data.  

Taste-wise, maybe my new method should be "markModified()" for consistency, but "markDirty()" is clearer to me.  The commitTimer is now used as a single-shot, so maybe it should be ditched in favour of  QTimer::singleShot().

[1] www.linuxpowertop.org
Comment 1 Alan Jenkins 2007-10-01 22:45:46 UTC
Created attachment 21733 [details]
Fix storage backend polling

This can be tested by comparing powertop output before and after.  Before,
powertop should show ~0.4 wakeups/s on idle.  After, it should hardly show up
at all (when idle).

Note.  "idle" includes "not fetching feeds".  I.e. this wouldn't make a
difference if, like me, you had a dead feed that akregator keeps trying to
refetch.
Comment 2 Eckhart Wörner 2007-10-04 15:40:21 UTC
Created attachment 21751 [details]
Improved patch using QTimer::singleShot()

I changed your patch a bit, it now uses QTimer::singleShot() instead of an own
QTimer object, moves markDirty() to private section of the class. (Is there any
reason not to do so?)
Comment 3 Alan Jenkins 2007-10-04 16:00:51 UTC
Looks fine to me.  I was slightly puzzled by the lack of existing private methods so I put it next to slotCommit().  (Perhaps it's not usual to declare a slot as private?)

Thanks for looking at it!

P.S.  I wonder how many people would take it the wrong way if I said I'd posted a patch on the "akregator haxx0rz" website :-).
Comment 4 Eckhart Wörner 2007-10-06 02:23:39 UTC
Created attachment 21761 [details]
Corrected version which takes feed storage changes into account
Comment 5 Eckhart Wörner 2007-10-06 03:10:13 UTC
SVN commit 721755 by ewoerner:

Fix storage backend waking up CPU every 3 seconds, original patch by Alan Jenkins, bump version number
BUG: 150389

 M  +9 -1      ChangeLog  
 M  +1 -1      src/aboutdata.h  
 M  +31 -21    src/mk4storage/feedstoragemk4impl.cpp  
 M  +1 -0      src/mk4storage/feedstoragemk4impl.h  
 M  +17 -14    src/mk4storage/storagemk4impl.cpp  
 M  +2 -0      src/mk4storage/storagemk4impl.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=721755