Bug 333752 - plasma-nm applet constantly uses 2% cpu and generates 25 wakeup events/s
Summary: plasma-nm applet constantly uses 2% cpu and generates 25 wakeup events/s
Status: RESOLVED FIXED
Alias: None
Product: plasma-nm
Classification: Plasma
Component: applet (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Jan Grulich
URL:
Keywords:
: 339065 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-23 07:32 UTC by LuRan
Modified: 2015-01-21 09:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.2.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LuRan 2014-04-23 07:32:45 UTC
When I have plasma-nm in the system-tray, plasma-desktop uses 1-3% cpu all the time and in powertop it generates 25 wakeup events every second. If I remove plasma-nm applet, plasma-desktop becomes quiet. I suspect it is because plasma-nm updates the wifi speed even when the main windows is hidden.

Reproducible: Always

Steps to Reproduce:
1. Add plasma-nm to system tray
2.
3.
Actual Results:  
In top plasma-desktop uses 2% cpu, and in powertop it wakes up 25 times/s

Expected Results:  
plasma-desktop should not have such cpu/wakeups when it is idle (and hidden).

tested with git snapshot bb3f0a26b1700e936773cd8e4eb33e2d6b694c2e
Comment 1 Jan Grulich 2014-04-23 08:12:52 UTC
Is this really a problem? It's probably due to the connection speed which is changing every second, but if I turn this off, next time it could be caused by signal strength and so on.
Comment 2 LuRan 2014-04-23 08:34:32 UTC
It helps to reduce the power consumption for about 1W, thus lowers the power consumption of my laptop from 10W to 9W in idle, it is a 10% improvement. I was not actively using the network and the upload and download is 0 all the time when I wrote the bug report so I think something is busy even when the number are not changing. Since those information are only visible when the main window is activated, can we only update them when they are visible? The only thing visible all the time is the signal strength, as it is not that crucial information everyone tend to pay a close attention to, maybe update them every 10s or so is enough?
Comment 3 Jan Grulich 2014-09-11 13:26:51 UTC
Git commit c3a11097c3c87bdbc550966f9e101ea6ff28715e by Jan Grulich.
Committed on 11/09/2014 at 13:26.
Pushed by grulich into branch 'master'.

Check download/upload speed from dataengine in QML code

Moving it from the model allows us to stop checking for changes when the
applet is collapsed.

M  +33   -10   applet/contents/ui/ConnectionItem.qml
M  +3    -14   libs/models/networkmodel.cpp
M  +1    -2    libs/models/networkmodel.h
M  +5    -78   libs/models/networkmodelitem.cpp
M  +3    -23   libs/models/networkmodelitem.h

http://commits.kde.org/plasma-nm/c3a11097c3c87bdbc550966f9e101ea6ff28715e
Comment 4 Lukáš Tinkl 2014-09-14 12:22:04 UTC
*** Bug 339065 has been marked as a duplicate of this bug. ***
Comment 5 Jan Grulich 2014-10-02 07:31:41 UTC
*** Bug 339598 has been marked as a duplicate of this bug. ***
Comment 6 Antonio Orefice 2014-10-03 06:33:25 UTC
Will this work with kde4?
I'm having some troubles compiling from git source without KF5
Comment 7 Jan Grulich 2014-10-03 06:51:33 UTC
Unfortunately it won't work with kde4, because we didn't backport this fix. I would like to keep plasma-nm in KDE 4 as it is to be sure it works and there are no other issues.
Comment 8 Antonio Orefice 2014-10-03 07:23:20 UTC
Could i ask you to reconsidert that or maybe tell us a way to slow down the polling?

thank you in advance
Comment 9 Antonio Orefice 2014-10-04 14:29:09 UTC
Ok, while we'll wait for KDE5, i found that 
kdeplasma-applets-networkmanagement (i think it was knetworkmanager applet) seems a fair replacement for plasma-nm and use almost 0% cpu.
Comment 10 Jan Grulich 2014-10-06 10:29:10 UTC
Git commit 852b33ed2f2065acd4921873e71a1d730cb645f1 by Jan Grulich.
Committed on 11/09/2014 at 13:26.
Pushed by grulich into branch '0.9.3'.

Check download/upload speed from dataengine in QML code

Moving it from the model allows us to stop checking for changes when the
applet is collapsed.

M  +27   -11   applet/declarative/contents/ui/ConnectionItem.qml
M  +6    -0    applet/declarative/contents/ui/main.qml
M  +3    -14   libs/models/networkmodel.cpp
M  +1    -2    libs/models/networkmodel.h
M  +5    -82   libs/models/networkmodelitem.cpp
M  +3    -21   libs/models/networkmodelitem.h

http://commits.kde.org/plasma-nm/852b33ed2f2065acd4921873e71a1d730cb645f1
Comment 11 Jan Grulich 2014-10-06 10:31:36 UTC
@Antonio: I backported the fix from Plasma 5 to KDE 4. Can you please test it to see whether it works as expected?
Comment 12 Antonio Orefice 2014-10-06 10:36:50 UTC
I'll test as soon as possible.
Meanwhile i thank you very much for your efforts.
Comment 13 Antonio Orefice 2014-10-12 12:29:37 UTC
Hi again and sorry for the late reply.
I'was not totally sure how to download it, so i made a snapshot from your commit:
http://quickgit.kde.org/?p=plasma-nm.git&a=snapshot&h=852b33ed2f2065acd4921873e71a1d730cb645f1
and it builded well.

It seems the issue is solved, many thanks.
Comment 14 Antonio Orefice 2014-10-12 12:54:48 UTC
Anyway, on an average of 300 seconds, top reported a plasma-desktop usage of: 
0.111% (+0.000%) with a clean systray
0.263% (+0.152%) with kdeplasma-applets-networkmanagement
0.345% (+0.234%) with plasma-nm

..So there is still at least a 0.082% margin of improvement :D

Again, thank you for your hard work.
Comment 15 Jan Grulich 2014-10-13 07:57:36 UTC
Well, plasma-nm compared to the previous NM applet updates constantly quite a lot values in the model, like signal strenght, bitrate and so on. That probably takes more cpu than before.