Bug 357597 - High Plasmashell CPU Usage With Animated Desktop Widgets
Summary: High Plasmashell CPU Usage With Animated Desktop Widgets
Status: RESOLVED DUPLICATE of bug 356479
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.5.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL: https://forums.opensuse.org/showthrea...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-05 21:46 UTC by Gordon
Modified: 2016-02-11 15:36 UTC (History)
5 users (show)

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


Attachments
Valgrind log (602.90 KB, text/plain)
2016-02-09 18:04 UTC, Giusy Digital
Details
Valgrind log 2 (1.29 MB, text/plain)
2016-02-09 18:07 UTC, Giusy Digital
Details
plasmashell strain on the CPU with no other programs running (227.04 KB, image/png)
2016-02-09 18:23 UTC, Quantum Five
Details
CPU load goes back to normal after plasmashell restart (243.04 KB, image/png)
2016-02-09 18:27 UTC, Quantum Five
Details
here is my callgrind file as requested (667.15 KB, text/plain)
2016-02-10 01:02 UTC, Quantum Five
Details
plasmashell serious strains on the CPU after 8+ hours of work (340.53 KB, image/png)
2016-02-10 01:08 UTC, Quantum Five
Details
here is the list of all libxcb debugging symbols available on my KUbuntu install (192.22 KB, image/png)
2016-02-11 15:36 UTC, Quantum Five
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon 2016-01-05 21:46:29 UTC
When animated widgets are added to the desktop then the plasmashell CPU usage increases dramatically. For example, the following widgets produce animated video:

- Load Monitor
- Network Monitor
- Memory Status
- Analog Clock (with second hand)

According to the "top" program on my laptop, the plasmashell process uses less than 1% of the CPU without any animated widgets. However, when these four widgets are added to the desktop then the plasmashell CPU usage jumps immediately to 5% and goes up quickly from there until I restart plasmashell. As an example, if I let plasmashell run for about 4 hours without restarting then the plasmashell CPU utilization grows to around 50% of my 8 core Intel i7-4810MQ CPU @ 2.80 GHz.


Reproducible: Always

Steps to Reproduce:
1. Do a clean install of an OS with Plasma 5 such as OpenSUSE Leap 42.1 which I am using.
2. Open a Konsole session and run the "top" program. Note that the plasmashell CPU usage without any animated widgets is small (less than 1% on my laptop).
3. Add the following four animated widgets: Load Monitor, Analog Clock (with second hand enabled), Network Monitor and Memory Status.
4. Monitor the plasmashell's CPU usage with the "top" program. Note that, with these four animated widgets, plasmashell's CPU usage spikes to about 5 times the usage without these four widgets.  Also, plasmashell's CPU usage will grow dramatically from there over time.  After a few hours plasmashell's CPU usage will increase to 20% to 50% until plasmashell is restarted.


Actual Results:  
CPU usage increases dramitically.

Expected Results:  
CPU usage should either not increase or should increase modestly.
Comment 1 Giusy Digital 2016-01-29 08:51:45 UTC
I can confirm this on Arch Linux.
Comment 2 Quantum Five 2016-02-09 00:28:57 UTC
Unfortunately I can confirm that KUbuntu is also affected ...

I am running KUbuntu 15.10 with all available patched applied from ppa:kubuntu-ppa/backports. My plasmashell version is 5.5.3 and I am using System Load widget. Interestingly is that after several hours the widget becomes completely unresponsive (but I can launch the program it via K menu).

I use my system for day to day work and I can confirm that after 8 hours the CPU usage is rather high (~30%) when no other programs are running (and you can feel that your computer has become sluggish). Killing and restarting plasmashell always cures it (I can provide a screen shot of "before" and "after"). It's VERY obvious.

Last Friday I left the computer running over the weekend (my session running and locked with no screen saver, no programs running), and when I logged back in on Monday, the CPU usage was so high, couldn't do anything but restart it.

My desktop has a 8 x Intel Core i7-4770 CPU @ 3.4 GHz CPU and 16G of RAM. So it's certainly not an old and slow machine.

I hope you guys will now believe that this is indeed a KDE issue.

Thank you.
Comment 3 Giusy Digital 2016-02-09 08:12:21 UTC
(In reply to Quantum Five from comment #2)
> Unfortunately I can confirm that KUbuntu is also affected ...
> 
> I am running KUbuntu 15.10 with all available patched applied from
> ppa:kubuntu-ppa/backports. My plasmashell version is 5.5.3 and I am using
> System Load widget. Interestingly is that after several hours the widget
> becomes completely unresponsive (but I can launch the program it via K menu).
> 
> I use my system for day to day work and I can confirm that after 8 hours the
> CPU usage is rather high (~30%) when no other programs are running (and you
> can feel that your computer has become sluggish). Killing and restarting
> plasmashell always cures it (I can provide a screen shot of "before" and
> "after"). It's VERY obvious.
> 
> Last Friday I left the computer running over the weekend (my session running
> and locked with no screen saver, no programs running), and when I logged
> back in on Monday, the CPU usage was so high, couldn't do anything but
> restart it.
> 
> My desktop has a 8 x Intel Core i7-4770 CPU @ 3.4 GHz CPU and 16G of RAM. So
> it's certainly not an old and slow machine.
> 
> I hope you guys will now believe that this is indeed a KDE issue.
> 
> Thank you.

Hi, I find a workaround on my Arch Linux system.

Open NotificationIcon.qml file with root permission in
/usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui

Search for line 
"running: visible"
in "PlasmaComponents.BusyIndicator" section and change it in
"running: false"

After that, plasmashell should use only 4-5% of CPU load.
Comment 4 David Edmundson 2016-02-09 09:54:26 UTC
Some improvement was added in latest frameworks speeding up a certain event filter.



also I need some sort of logs

Please can you run:
kquitapp5 plasmashell
valgrind --tool=callgrind --instr-atstart=no plasmashell

wait till CPU usage is high then

callgrind_control -i on
*wait a  bit*
callgrind_control -i off

then quit plasma and upload the relevant callgrind.something.out file.
Comment 5 David Edmundson 2016-02-09 09:54:48 UTC

*** This bug has been marked as a duplicate of bug 356479 ***
Comment 6 Giusy Digital 2016-02-09 09:59:32 UTC
(In reply to David Edmundson from comment #4)
> Some improvement was added in latest frameworks speeding up a certain event
> filter.
> 
> 
> 
> also I need some sort of logs
> 
> Please can you run:
> kquitapp5 plasmashell
> valgrind --tool=callgrind --instr-atstart=no plasmashell
> 
> wait till CPU usage is high then
> 
> callgrind_control -i on
> *wait a  bit*
> callgrind_control -i off
> 
> then quit plasma and upload the relevant callgrind.something.out file.

Have I to do this with "running: visible" in NotificationIcon.qml file?

Ah, please, change status. This bug is not resolved.
Comment 7 David Edmundson 2016-02-09 10:01:15 UTC
without the change.

also it is marked as being a duplicate of another bug which is tracking a practically identical discussion.
Comment 8 Giusy Digital 2016-02-09 10:06:09 UTC
(In reply to David Edmundson from comment #7)
> without the change.
> 
> also it is marked as being a duplicate of another bug which is tracking a
> practically identical discussion.

OK, I'll do the log when I can.

But this is the first time I try that.
After quitting plasma, where can I find callgrind.something.out file? Same directory in which I executed Konsole?
Comment 9 Giusy Digital 2016-02-09 18:04:37 UTC
Created attachment 97112 [details]
Valgrind log

Firts time I use valgrind. Don't know If I did the job well.
Comment 10 Giusy Digital 2016-02-09 18:07:05 UTC
Created attachment 97113 [details]
Valgrind log 2

Did another. 
With two network monitor and one CPU monitor, during reproduction of a YouTube video, plasmashell/valgring process at about 20 % CPU load.
Comment 11 Quantum Five 2016-02-09 18:16:41 UTC
Thank you for your help David !

I am currently running valgrind and I'll grab the logs in the evening or tomorrow morning (I might let it run overnight).

Meanwhile, I have attached two screenshots of "before and after" killing and restarting plasmashell. So I used my computer all day yesterday and let it running overnight without any other programs running. This morning you can see the CPU constantly loaded at +30% even if no program is running in the background. Then you can see on the picture that CPU returns to normal once I kill and restart plasmashell.
Comment 12 Quantum Five 2016-02-09 18:23:18 UTC
Created attachment 97114 [details]
plasmashell strain on the CPU with no other programs running

The CPU load generated by plasmashell after ~16 hours of running.
Comment 13 Quantum Five 2016-02-09 18:27:42 UTC
Created attachment 97115 [details]
CPU load goes back to normal after plasmashell restart

Obvious difference ...There's seems to be a slight drop in the memory consumption too after plasmashell restart. About 200MB.
Comment 14 Quantum Five 2016-02-10 01:02:24 UTC
Created attachment 97121 [details]
here is my callgrind file as requested

Hope this helps.
Comment 15 Quantum Five 2016-02-10 01:08:34 UTC
Created attachment 97122 [details]
plasmashell serious strains on the CPU after 8+ hours of work

It is true that valgrind (and ONLY valgrind) was running on the background but still ... At that time my applications were getting noticeably slow, almost unresponsive. Once plasmashell was killed, everything went back to normal (and again 200MB or RAM were freed).
Comment 16 David Edmundson 2016-02-10 16:04:31 UTC
Your log:

53.71% of the time spent handling X events from the DRI driver saying "I've done something". 

We're getting ~1 million of these events. 
How long did you have callgrind on for? It seems excessive. 

Because of that 30% of the total time is then spent in KDE code processing these X events.  That's something I super optimised last month that you clearly don't have yet. Latest frameworks will bring a huge improvement for you as that's now down to near zero, making us ~30% faster.

Though I don't get why we're getting so many of these events.

Other thing that's potentially super important, that I hadn't seen before. 27% of the time is spend in __memmove in libc. 
Unfortuantely I can't really see  what's going on there as we don't have symbols for libxcb (not sure if it's you who needs to install them or me)
But one thing it could mean is we're swapping graphic card memory.  Can you install intel-gpu-tools and run intel-gpu-top / intel-gpu-overlay and see if that says anything useful.
Comment 17 David Edmundson 2016-02-10 16:12:33 UTC
>Unfortuantely I can't really see what's going on there as we don't have symbols for libxcb (not sure if it's you who needs to install them or me)

Ah found out.

Could you install libxcb debug symbols and redo this for me again?
Comment 18 Giusy Digital 2016-02-10 17:06:09 UTC
Did you find out something in my log?
I had to return to set "running: false" in that file because plasmashell process uses 6-7% of CPU load that seems excessive to me for one network and CPU monitor widget, even if it's not worse than the other friend.
Comment 19 Quantum Five 2016-02-11 15:31:59 UTC
Hi David,

Unfortunately in KUbuntu there are many debug extensions for libxcb and not one is called just "libxcb-dbg". No meta package either as far as I can tell. I will provide a screen shot with all available libxcb debug packages and then you can indicate the ones you need.

Question: are any private information recorded by libxcb debug extensions inside callgrind output file ?

Thank you.
Comment 20 Quantum Five 2016-02-11 15:36:17 UTC
Created attachment 97153 [details]
here is the list of all libxcb debugging symbols available on my KUbuntu install

Which one of them do you need ?