Bug 180335 - When playing music, X CPU usage goes up a lot.
Summary: When playing music, X CPU usage goes up a lot.
Status: RESOLVED WORKSFORME
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 2.3-GIT
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-11 16:04 UTC by Dion Moult
Modified: 2009-12-17 12:28 UTC (History)
3 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 Dion Moult 2009-01-11 16:04:41 UTC
Version:           2.0-r1 (using Devel)
OS:                Linux
Installed from:    Compiled sources

When not playing music, Amarok uses about 2% CPU and X also uses about 2% CPU. When playing music, Amarok jumps up to around 8% (fluctuates) and X jumps up to 33% (around that). The jump for Amarok to 8% (mpd only uses 3%) is probably due to Amarok's bulk, but why is it causing X to leap up?

CPU: AMD Turion X2 dual-core
GPU: NVIDIA GeForce 9100M G
KDE: 4.1.87

Notice I am using NVIDIA, so this could be an NVIDIA issue. However, I would be good to look into this.
Comment 1 Kevin Funk 2009-01-11 19:54:47 UTC
Can confirm this and it is definetely caused by the ProgressSlider in Amarok which is updating too fast it seems.
Workaround for me: Add m_slider->hide(); in ProgressSlider.cpp.
Solves high CPU usage.

GPU: NVIDIA GeForce 8600M GT
KDE: 4.2.60
Comment 2 Mark Kretschmann 2009-01-11 20:04:25 UTC
Ok, I'm currently hacking on this class anyway, so I'll have a look at this problem.
Comment 3 Mark Kretschmann 2009-01-13 13:52:54 UTC
Just tested: My X-server uses about 4% CPU while Amarok is visible. This doesn't sound excessive to me...

* NVIDIA 7300 GPU with proprietary driver
* AMD Athlon 64 X2 5000
* Amarok SVN, KDE 4.1.3


So the issue could well be something else. E.g. your graphics driver.

@Kevin: The update interval is currently 100ms. That's definitely not too much. Any less would make the animation very jerky.
Comment 4 Dion Moult 2009-01-13 14:17:36 UTC
Note, I have got Amarok installed from the kde-testing overlay (keyworded ~amd64) from Gentoo Portage.

When Amarok is just visible, it takes up around 5-6 or so %, however when it starts playing music, then X jumps up.
Comment 5 Mark Kretschmann 2009-01-13 14:39:46 UTC
Ah, I forgot to mention: 4% was while playing.
Comment 6 Kevin Funk 2009-01-13 15:52:32 UTC
After commenting out a lot of code and replacing Amarok::TimeSlider with a normal QSlider I found that the bottleneck is the QSlider::setValue() function. The X cpu usage gets down if you use a very small progress bar aswell.
Please report upstream, seems to be a serious issue in Qt itself.
Comment 7 Dion Moult 2009-01-20 15:00:22 UTC
The Qt people (well #qt) have suggested that Amarok should provide a work around, or perhaps it might be caused by the intervals at which QSlider::SetValue() is called, perhaps it should be less.

Might I recommend that Amarok find a workaround for this issue?
Comment 8 Kevin Funk 2009-01-20 15:14:42 UTC
Moult, the QSlider is updated every ~100ms (=> ~10 FPS), thats not much. The slider would get very skippy if you slow that down even more. Markey said that already. I dont know how to fix it, to be true.
Comment 9 icefox 2009-01-20 16:16:25 UTC
Why don't you use valgrind to profile Amarok and see what is actually eating the cpu rather then guessing?
Comment 10 Seb Ruiz 2009-04-12 07:59:34 UTC
I remember this bug being fixed some time ago, and I can no longer reproduce the problem here.
Comment 11 Seb Ruiz 2009-04-12 08:04:13 UTC
Sorry, I was looking at Amarok's cpu usage, not X's.
Comment 12 Mark Kretschmann 2009-04-12 08:38:50 UTC
Even so, my X CPU usage is at something like 2% while Amarok is playing and visible, with SVN trunk.

So I would say, either this "bug" has been fixed, or rather people's graphics drivers are to blame. Especially on Linux problems with those are not uncommon, are they? :)

I don't think it makes sense to keep this report open, as I don't think Amarok is causing the issue.
Comment 13 Benjamin Schindler 2009-04-12 09:55:42 UTC
Okay, I'm on the release version - so may be something changed in SVN. But: 

I'm on a 5 year old laptop. It runs just fine and things work basically smooth, but not so with amarok

- When playing music, amarok minimized: 5% amarok, 5% X
- When amarok is maximized: 10% amarok, 12% X (wtf??)

- when I run powertop, amarok causes ~150 wakeups even when not playing music at all!! 

This bug is not fixed. Please reopen.

I know, the maximized case could be an xorg thing - 12% is a lot. But 10% inside amarok is also way too much
Comment 14 Mark Kretschmann 2009-04-12 10:01:08 UTC
@Benjamin: Are you using KDE 4.2? Older versions have a bug in Phonon that's causing the high number of wakeups.
Comment 15 Benjamin Schindler 2009-04-12 11:01:11 UTC
Yes, I'm on kde-4.2
Comment 16 Lydia Pintscher 2009-04-12 19:11:32 UTC
reopening based on previous comments
Comment 17 Mark Kretschmann 2009-04-12 19:29:47 UTC
Not so fast. This is a very diffuse report, talking about two different things:

1) High CPU usage of X server (not reproducible by me).

2) High number of wakeups shown in PowerTOP. I could in fact reproduce this issue (with KDE 4.2.2, Phonon-xine, Amarok trunk), but only after starting to play one track, then stopping it. This may still be a Phonon issue; further testing (especially with different backends) is required.

For my taste this report is too fuzzy to be of use at this point - of the sort that stays open forever without ever reaching a real conclusion.

So please let's try to look at each issue separately. Benjamin could start by using a different Phonon backend, and then comparing wakeups in PowerTOP.
Comment 18 Benjamin Schindler 2009-04-14 13:30:30 UTC
(In reply to comment #17)
> Not so fast. This is a very diffuse report, talking about two different things:
> 
> 1) High CPU usage of X server (not reproducible by me).

I'm seeing about 10%. If you take a modern machine, this is likely to drop to about 1% so may be that's why you're not seing this?
> 
> 2) High number of wakeups shown in PowerTOP. I could in fact reproduce this
> issue (with KDE 4.2.2, Phonon-xine, Amarok trunk), but only after starting to
> play one track, then stopping it. This may still be a Phonon issue; further
> testing (especially with different backends) is required.
> 
> For my taste this report is too fuzzy to be of use at this point - of the sort
> that stays open forever without ever reaching a real conclusion.
> 
> So please let's try to look at each issue separately. Benjamin could start by
> using a different Phonon backend, and then comparing wakeups in PowerTOP.

I'll do so asap. I only have the xine backend installed. I'm right now finishing my master thesis so it might take a few days until I get back
Comment 19 Mark Kretschmann 2009-05-17 13:05:07 UTC
Closing the report for lack of feedback and lack of reproducibility.

I've just tested this again with the latest Amarok SVN code and KDE 4.2.2 on Kubuntu 8.10, and X was at about 1% CPU, while Amarok was visible and playing.

So this is probably not an Amarok issue, but rather a problem somewhere else in the graphics stack.
Comment 20 Marcus Better 2009-11-23 16:26:25 UTC
When Amarok is playing, the X.org CPU usage jumps up to over 70%. If I stop or pause the music, it immediately drops to the normal level (below 10%). This is with Amarok 2.2.1-2 on Debian amd64, Qt 4:4.6.0~rc1-1. The system is a Thinkpad T61, Intel Core 2 Duo, Intel graphics.
Comment 21 Myriam Schweingruber 2009-11-23 20:05:24 UTC
Marcus, I can't reproduce this at all, using Amarok 2.2-git o today, KDE 4.3.3, Kubuntu 9.10, on a Lenovo Thinkpad W500, ATI graphic card. There must be something wrong with your graphic installation, not an Amarok problem.
Comment 22 Dion Moult 2009-11-23 23:56:54 UTC
Being the original bug reporter I would like to say that I also, for quite some time have no longer been experiencing this bug. KDE 4.3.3, amd64, Gentoo. (Now using nvidia-drivers 190.42-r3)
Comment 23 Dion Moult 2009-12-17 05:23:33 UTC
Experiencing this again in KDE 4.3.80, Amarok 2.2.1-r2, Gentoo, nvidia-drivers 195.22. Amarok, visible or not, when playing is ~10%-13% CPU. X itself seems to be behaving and is at it's usual CPU %. Using Xine backend.
Comment 24 Myriam Schweingruber 2009-12-17 12:28:30 UTC
Again, no way to reproduce this with my settings and a current Amarok 2.2-git, build of this morning.
Please, don't reopen bugs that are clearly due to something else than Amarok, since none of the devs can reproduce it. Check your graphics settings, X settings, whatever.
Amarok uses 0% CPU when idle here and 1-6% of one core when playing, same machine as in comment #21, KDE 4.3.4