Bug 324045 - Amarok unnecessarily eats CPU time when Analyzer applet is enabled.
Summary: Amarok unnecessarily eats CPU time when Analyzer applet is enabled.
Status: RESOLVED WORKSFORME
Alias: None
Product: amarok
Classification: Applications
Component: Context View/Spectrum Analyzer (show other bugs)
Version: 2.8.0
Platform: unspecified Linux
: NOR normal
Target Milestone: 2.9
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-26 06:00 UTC by James Eder
Modified: 2015-05-21 08:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Eder 2013-08-26 06:00:35 UTC
With
1. no music playing (or other tasks running such as music file indexing),
2. the Amarok window closed (in system tray mode), and
3. the spectrum analyzer applet enabled,
Amarok consumes around 1% of one CPU's time.   Through experimentation, I was able to determine that disabling the spectrum analyzer applet causes Amarok use little or no CPU time when idle and the main window is closed.


Reproducible: Always
Comment 1 Mark Kretschmann 2013-08-26 09:35:35 UTC
Of course the analyzer will require CPU time when it is being calculated and rendered.  I don't understand your point here. Care to explain?
Comment 2 James Eder 2013-08-26 16:14:21 UTC
It consumes CPU time while minimized with no song playing.  I don't understand the need to render and calculate when no part of the window is being displayed and there's no audio to analyze.  It shouldn't be calculating and rendering in that state.  It should be idle and not eating battery needlessly.
Comment 3 Mark Kretschmann 2013-08-26 16:41:27 UTC
Oh, I see what you mean. Anyway, you are wrong, the Analyzer is actually not active at all when Amarok is not visible. And I'm quite proud of it too, because it took quite some extra care to make it like this. Its timer is completely disabled unless it's needed.

Random small fluctuations in CPU usage can be due to other parts of Amarok that are working in the background.
Comment 4 James Eder 2013-08-26 18:17:35 UTC
It's fairly consistent and it goes away entirely when I disable the Analyzer applet.  I'm not making this up.

You can check with powertop.  With Amarok in tray mode without the analyzer sits at about .20 events/s.  With the analyzer enabled it jumps up to around 24.2 events/s while minimized or hidden by tray mode.
Comment 5 Myriam Schweingruber 2013-08-27 08:18:00 UTC
There is a known leak in the gstreamer library the phonon backend uses, but that is upstream and we have no influence over that.
Comment 6 Mark Kretschmann 2013-08-27 08:32:32 UTC
A leak causing CPU usage? Wat?
Comment 7 James Eder 2013-08-27 17:02:04 UTC
(In reply to comment #5)
> There is a known leak in the gstreamer library the phonon backend uses, but
> that is upstream and we have no influence over that.

A link would be useful.
Comment 8 Dima Ryazanov 2013-12-22 23:54:31 UTC
I'm running into this bug, too: I'm seeing 2-3% CPU usage, and it goes away if I remove the applet. Also confirmed by looking at "strace" output.
Comment 9 Myriam Schweingruber 2015-02-18 09:34:53 UTC
Closing correctly. The analyzer applet has had some code adaptations since this report was opened, please file a new bug if you can reproduce this with the upcoming Amarok 2.9 or current git
Comment 10 Amichai Rothman 2015-05-12 11:26:40 UTC
FWIW, this still happens with Amarok 2.8.0 on Kubuntu 14.10 (KDE 4.14.2). I came across this bug report when trying to figure out why Amarok is constantly taking up ~4.7% CPU when minimized and idle (nothing playing). After removing the analyzer it went down to 0.0%.
Comment 11 Alexander Kläser 2015-05-21 08:56:37 UTC
I am experiencing the same problem on Kubuntu 15.04 using Amarok in version 2:2.8.0-0ubuntu4. After right click on the plugin in Amarok and choosing to remove the applet, the cpu usage stopped. I straced amarok and got repeatedly the following output (maybe that helps to identify the problem):

-------------------- 8< --------------------
...
poll([{fd=7, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"\231\10\10\0\n\1@\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 32}], 1) = 32
recvmsg(7, 0x7ffc337ccc90, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=7, revents=POLLIN|POLLOUT}])
recvmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"f\0\265\357\1\0\0\0\n\1@\3\t\0\0\0\232\211~\364\0\0\0\0f\272&\0a^\34\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 96
writev(7, [{"+\7\1\0", 4}, {NULL, 0}, {"", 0}], 3) = 4
poll([{fd=7, events=POLLIN}], 1, 4294967295) = 1 ([{fd=7, revents=POLLIN}])
recvmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\1\1\266\357\0\0\0\0J\0@\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(7, 0x7ffc337ccc90, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 15) = 1 ([{fd=3, revents=POLLIN}])
read(3, "\1\0\0\0\0\0\0\0", 16)         = 8
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 15) = 0 (Timeout)
read(3, 0x7ffc337cdaf0, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 0) = 0 (Timeout)
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 0) = 0 (Timeout)
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 0) = 0 (Timeout)
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 0) = 0 (Timeout)
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
write(3, "\1\0\0\0\0\0\0\0", 8)         = 8
recvmsg(7, 0x7ffc337cd960, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}, {fd=45, events=POLLIN}, {fd=46, events=POLLIN}, {fd=48, events=POLLPRI}, {fd=49, events=POLLIN}, {fd=72, events=POLLIN}], 10, 0) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(7, 0x7ffc337cd980, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"\231\7\5\0\n\1@\3\1\0\0\0\1\0\0\0 \0\0\0", 20}, {NULL, 0}, {"", 0}], 3) = 20
poll([{fd=7, events=POLLIN}], 1, 4294967295) = 1 ([{fd=7, revents=POLLIN}])
recvmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\267\357\5\0\0\0\20\4\0\0r\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 52
recvmsg(7, 0x7ffc337ccb10, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(7, 0x7ffc337ccb10, 0)           = -1 EAGAIN (Resource temporarily unavailable)
ioctl(70, 0x400c645f, 0x7ffc337cce20)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccd80) = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccd80) = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccdb0) = 0
ioctl(70, 0xc0086457, 0x7ffc337ccbf0)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccbe0) = 0
ioctl(70, 0x4020645d, 0x7ffc337ccc70)   = 0
ioctl(70, 0xc0086457, 0x7ffc337cc880)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337cc870) = 0
ioctl(70, 0x400c645f, 0x7ffc337cc880)   = 0
ioctl(70, 0x40046460, 0x7ffc337ccb80)   = 0
ioctl(70, 0x40046460, 0x7ffc337ccb90)   = 0
ioctl(70, 0x40406469, 0x7ffc337ccb20)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccae0) = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccae0) = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccb10) = 0
ioctl(70, 0xc0086457, 0x7ffc337ccb00)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccaf0) = 0
ioctl(70, 0x400c645f, 0x7ffc337ccb00)   = 0
ioctl(70, 0xc0086457, 0x7ffc337cc8a0)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337cc890) = 0
ioctl(70, 0x400c645f, 0x7ffc337cc8a0)   = 0
ioctl(70, 0x40046460, 0x7ffc337ccb80)   = 0
ioctl(70, 0x40046460, 0x7ffc337ccb90)   = 0
ioctl(70, 0x40406469, 0x7ffc337ccb20)   = 0
ioctl(70, 0xc0086457, 0x7ffc337ccb00)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337ccaf0) = 0
ioctl(70, 0x400c645f, 0x7ffc337ccb00)   = 0
ioctl(70, 0xc0086457, 0x7ffc337cc8a0)   = 0
ioctl(70, VIDIOC_INT_RESET, 0x7ffc337cc890) = 0
ioctl(70, 0x400c645f, 0x7ffc337cc8a0)   = 0
ioctl(70, 0x40046460, 0x7ffc337ccb80)   = 0
ioctl(70, 0x40046460, 0x7ffc337ccb90)   = 0
ioctl(70, 0x40406469, 0x7ffc337ccb20)   = 0
...
-------------------- 8< --------------------