Ubuntu

compiz consuming a lot of cpu

Reported by Marco Biscaro on 2011-06-30
This bug affects 309 people
Affects Status Importance Assigned to Milestone
Compiz
Medium
Unassigned
Compiz Core
Medium
Unassigned
Unity
Medium
Unassigned
compiz (Ubuntu)
Medium
Unassigned
unity (Ubuntu)
Medium
GMPH

Bug Description

This problem is exclusive to unity (when running compiz with gnome-panel, this doesn't happen).

1. Close all windows opened, if any
2. Open a terminal and run 'top'
3. Notice that compiz is consuming a lot of CPU time (although there is nothing special running). In my case, it's consuming about 13% when idle.
4. Unmaximize the terminal window, if maximized, and start moving the window slowly
5. Notice that compiz is now consuming much more CPU than before (in my case, arround 50%).
6. Open a video.
7. Notice that compiz consume much more CPU than idle (about 25% in my case), although I'm not doing anything related to window management.
8. (optional) Install the gnome-panel package and choose "GNOME classic" in login screen. Start compiz with "compiz --replace" and follow the steps from 1 to 7. Notice that the CPU consuming is much lower (in my case, 1% when idle, 25% when moving the window and 9% with the video).

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: unity 4.0.1-0ubuntu2 [modified: usr/bin/unity-preferences usr/share/applications/unity-preferences.desktop]
ProcVersionSignature: Ubuntu 3.0-2.3-generic 3.0.0-rc4
Uname: Linux 3.0-2-generic i686
Architecture: i386
CompizPlugins: [core,bailer,detection,composite,opengl,compiztoolbox,decor,vpswitch,imgpng,resize,snap,grid,regex,move,gnomecompat,mousepoll,animation,unitydialog,wall,workarounds,place,expo,ezoom,session,staticswitcher,fade,scale]
Date: Thu Jun 30 11:54:20 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha i386 (20110610)
ProcEnviron:
 LANGUAGE=pt_BR:en
 LANG=pt_BR.UTF-8
 SHELL=/bin/bash
SourcePackage: unity
UpgradeStatus: No upgrade log present (probably fresh install)

Could someone confirm this bug? If it really happens with every system, it's a big regression from natty.

Jason Smith (jassmith) wrote :

Marking confirmed. I have some work in this area though ultimately this is a team effort to reduce CPU usage. We need to find whats causing the CPU spike.

Changed in unity:
importance: Undecided → High
status: New → Confirmed

Jason, there is something that I can do to help debugging?

Changed in unity (Ubuntu):
status: New → Confirmed
Daniel van Vugt (vanvugt) wrote :

Isn't this a duplicate of bug 782810?

On a totally idle machine I find compiz is still using 1-2% CPU. And that's with an i7-2600. This is obviously bad for the battery life of notebook users.

Daniel van Vugt (vanvugt) wrote :

See also bug 813409 where unity-panel-service uses around the same level of constant CPU as compiz. Though switching to a VT console, compiz stops using the CPU while unity-panel-service doesn't.

On Jul 20, 2011 7:32 PM, "Daniel van Vugt" <email address hidden> wrote:
>
> See also bug 813409 where unity-panel-service uses around the same level
> of constant CPU as compiz. Though switching to a VT console, compiz
> stops using the CPU while unity-panel-service doesn't.

Indeed. Compiz isn't drawing the screen to show the result of polling for
load so its essentially sleeping during this time
>
> --
> You received this bug notification because you are a member of Unity
> Bugs, which is subscribed to unity in Ubuntu.
> https://bugs.launchpad.net/bugs/803943
>
> Title:
> compiz consuming a lot of cpu
>
> Status in Unity:
> Confirmed
> Status in “unity” package in Ubuntu:
> Confirmed
>
> Bug description:
> This problem is exclusive to unity (when running compiz with gnome-
> panel, this doesn't happen).
>
> 1. Close all windows opened, if any
> 2. Open a terminal and run 'top'
> 3. Notice that compiz is consuming a lot of CPU time (although there is
nothing special running). In my case, it's consuming about 13% when idle.
> 4. Unmaximize the terminal window, if maximized, and start moving the
window slowly
> 5. Notice that compiz is now consuming much more CPU than before (in my
case, arround 50%).
> 6. Open a video.
> 7. Notice that compiz consume much more CPU than idle (about 25% in my
case), although I'm not doing anything related to window management.
> 8. (optional) Install the gnome-panel package and choose "GNOME classic"
in login screen. Start compiz with "compiz --replace" and follow the steps
from 1 to 7. Notice that the CPU consuming is much lower (in my case, 1%
when idle, 25% when moving the window and 9% with the video).
>
> ProblemType: Bug
> DistroRelease: Ubuntu 11.10
> Package: unity 4.0.1-0ubuntu2 [modified: usr/bin/unity-preferences
usr/share/applications/unity-preferences.desktop]
> ProcVersionSignature: Ubuntu 3.0-2.3-generic 3.0.0-rc4
> Uname: Linux 3.0-2-generic i686
> Architecture: i386
> CompizPlugins:
[core,bailer,detection,composite,opengl,compiztoolbox,decor,vpswitch,imgpng,resize,snap,grid,regex,move,gnomecompat,mousepoll,animation,unitydialog,wall,workarounds,place,expo,ezoom,session,staticswitcher,fade,scale]
> Date: Thu Jun 30 11:54:20 2011
> InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha i386 (20110610)
> ProcEnviron:
> LANGUAGE=pt_BR:en
> LANG=pt_BR.UTF-8
> SHELL=/bin/bash
> SourcePackage: unity
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/unity/+bug/803943/+subscriptions

Daniel van Vugt (vanvugt) wrote :

Yeah I guessed it was compiz updating the screen. But experience tells me code can always be optimized, and logic tells me that if the screen is not changing then it should be possible to make compiz use negligible CPU.

Stefano Bagnatica (thepisu) wrote :

1) This is not a duplicate of #782810, because that was opened for Ubuntu 11.04. In our case, the CPU usage was OK in 11.04, and gone to 25% upgrading to 11.10.

2) Maybe it is related to ATI cards and fglrx drivers? I have ATI Radeen HD 4200.

3) Look also this question on AskUbuntu:
http://askubuntu.com/questions/67680/why-does-compiz-use-25-cpu-while-idle

Luke Hoersten (lukehoersten) wrote :

http://askubuntu.com/questions/67680/why-does-compiz-use-25-cpu-while-idle I'm having this same problem. 25% CPU is a best case for me. 60%+ is average. I'm on an nVidia card (Macbook Air). Any debug help needed, please let me know!

Jan Girlich (vollkorn) wrote :

I don't believe this bug is hardware-specific since I have an Intel GM965 and reports so far had Nvidia and Ati graphic cards.

Jan Nekvasil (jan-nekvasil) wrote :

I'ts definitely NOT hardware-specific. I have three different boxes on my desk right now; with Nvidia, ATI and Intel graphic card. all three of them are showing ~3% CPU usage by compiz in htop when idle.

eriks (eriks-kruze) wrote :

For me the same problem. On idle compiz is using more than 10% of CPU.
My graphic card: ATI Radeon Express 200M.
With Ubuntu 11.04 all was ok.

Nicholas Shatokhin (robotex) wrote :

Ubuntu 10.10 Compiz uses 12% of CPU.

Thom Pischke (thom-pischke) wrote :

Ditto here, about 12% of cpu with intel GMA, core 2 duo

compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 0c)

Nicholas Shatokhin (robotex) wrote :

Oh, sorry, I made mistake. Ubuntu 11.10, not 10.10. Videocard: NV GF8600M GS

José Antonio (jsilva-jcode) wrote :

Same problem on my Lenovo x220 with Ubuntu 11.10. 15% CPU all the time.

Sergio Callegari (callegar) wrote :

Confirmed. My first contact with unity after an upgrade to Oneiric.

When doing absolutely nothing (just a terminal running top) I get

compiz ~9% cpu

then another

5% goes away with unity-panel-service
4% with the dbus daemons
3% for the indicator multiload

(yes, the system is not really idle, I have a cpu load applet!)

This sounds weird to me and certainly not ok. Why an applet updating every second should end up making the system burn about 20% of its cpu resources?

Daniel van Vugt (vanvugt) wrote :

Sergio, the issue with indicator-multiload causing high CPU in compiz is bug 784055.

ladariha (riha-vladimir) wrote :

Same on Lenovo ThinkPad R400 (intel 4500mhd, c2d t6670)

undy (undy) wrote :

Same on eeepc 901 after upgrade to 11.10

Juris (juris-a) wrote :

Same on Lenovo S12 with nvidia ion and proprietary drivers.

Alejandro Benitez (benitezagm) wrote :

http://ubuntuforums.org/showthread.php?t=1860437 (Unity Laggy Ubuntu 11.10)

The Unity interface causes lags. Dragging windows is laggy, resizing windows is laggy, window animations are also laggy.

McEye (spam-mceye) wrote :

Same here.
DELL E6420

bryandrewery (bryan-shatow) wrote :

Dell optiplex with ATI card here.

Maurice Knopp (maurice-knopp) wrote :

I can also confirm this bug.

Lenovo Workstation with proprietary nvidia 280.13 driver and Quadro FX 1700 / 512MB Video Board and dual monitor config (twinview).

11.04 worked just fine.

Maurice Knopp (maurice-knopp) wrote :

I forgot, I'm using the 64 bit version of Ubuntu.

Ubuntu 11.10 32 bits, Lenovo T400, ATI Raden HD 3400, fglrx driver installed, same as all of you. At full speed of processor, is always using at least 1% of the CPU (throttling between 1% and 3% at full idle). I think this bug is also causing some slight choppy behaviour when dragging windows around.

Daniel van Vugt (vanvugt) wrote :

Simone, the "slightly choppy behaviour" with the fglrx driver is bug 763005.

Josh Burghandy (kid1000002000) wrote :

Confirmed; compiz consumes 4-30% of cpu cycles on my toshiba a135 1.7ghz. all the time. This makes a significant drain on my battery.

Jayson Rowe (jayson.rowe) wrote :

I am seeing the exact same symptoms (x84_64, btw). I'm using a Nvidia GTX 280 w/ Nvidia drivers. I am occasionally seeing compiz as high as 65-70%. If I slowly move a terminal window it will usually max out one of my 4 cores (AMD PII X4 965). Is there anything I can do to provide a log, or more information? I'm more than happy to do anything I can to get this resolved.

Jayson Rowe (jayson.rowe) wrote :

Here is 'htop' showing my compiz cpu usage (sitting at idle desktop)

Johan Jeppsson (johjep) wrote :

I also have this problem, although my compiz occasionally draws in excess of 50% CPU when idle. I have an Core i7 processor.

Similar here on Lenovo Thinkpad Edge AMD with Radeon card running 32bit and workstation with AMD Phenom II X2 / PNY Geforce 210 running 64bit. Compiz is at around 30% with Chromium, Thunderbird, Skype and TweetDeck running on the workstation. In addition the display is occasionally freezing when windows are resized.

Luke Hoersten (lukehoersten) wrote :

Anyone found a workaround to this problem?

ThomWilhelm (thomwilhelm) wrote :

I've switched back to using Unity 2D because of this issue on my laptop, compiz uses 25% even when idle which means if I do anything else my laptop heats up and the fan is quite noisy!

Any news from the devs if this being looked into?

Daniel van Vugt (vanvugt) wrote :

Hello all. Can you please verify the problem is specifically the Unity plugin? To do this...

1. Open a terminal and run "top". Verify the CPU usage is high before proceeding.
2. Run ccsm. If you don't have it then you need to install package "compizconfig-settings-manager".
3. In ccsm, untick the box for the Unity plugin. Your panel and launcher will vanish.
4. Look at the terminal window running top and verify the CPU usage for compiz has decreased to something more acceptable.
5. VERY IMPORTANT: Tick the box for the Unity plugin to enable it again.

If at any point you find that compiz crashes while ticking and unticking boxes you might end up in a state where Unity doesn't come back when you log in again. To fix this, press Ctrl+Alt+T to open a terminal, run ccsm, and tick the box for the Unity plugin. Alternatively, you can start ccsm from a virtual terminal by pressing Ctrl+Alt+F1, log in, and then run "env DISPLAY=:0 ccsm".

John Moodie (jhmoodie) wrote :

Unloading unity plugin and decorator makes no difference in my case.
64 bit with fglrx (Catalyst 11.10).

With top running in a terminal;

1: Open a browser, type a non-existent address in, such as http://non-existant-garbage.com
Compiz and Xorg cpu usage spikes to about 50% and 40% respectively and will continue to remain there until the browser request is cancelled (or until there is no spinning load icon or mouse pointer change or the windows is minimised)

2: Open software centre and install a program. Compiz and Xorg will spike and remain high until the program has installed and there is no spinning progress icon in the top bar.

Sounds like a polling issue?

Jayson Rowe (jayson.rowe) wrote :

Unloading the unity plugin and decorator also makes no difference for me either (Nvidia w/ proprietary drivers from repo).

I can duplicate what John describes above as well.

Daniel van Vugt (vanvugt) wrote :

Please include the actual CPU percentages you see compiz using, with unity active and inactive.

Jayson Rowe (jayson.rowe) wrote :

Seriously? I mean, come on. It's not like Compiz is using exactly 65% with unity enabled and 64% with Unity disabled. It varies. I can't really answer your question. I've seen Compiz use anywhere from 25%-80% of my CPU and it's not consistent at all. What IS consistent is I can open software centre and install a program. Compiz and Xorg will spike and remain high until the program has installed and there is no spinning progress icon in the top bar. Why don't you try that? I've been able to duplicate that behavior on every machine and virtual machine I've tried it on.

Jayson Rowe (jayson.rowe) wrote :

Sorry Daniel, didn't mean to sound snippy. It's just that this bug is particularly frustrating since it's so random. I can't give you what you want though, I've just spent a few minutes trying - nothing is consistent. I'm really close to having to switch to Unity2D or Shell, neither of which I want to do.

Daniel van Vugt (vanvugt) wrote :

Thanks, that's all the info I really needed.

I agree this and related compiz bugs are enough to make people want to switch.

I am presently working on improving the fix for bug 880707, and my new design should reduce compiz CPU usage too. So keep an eye on that one. It might help.

In the mean time, to minimize CPU, you should make sure these (default) settings are set in CCSM:
OpenGL: "Sync to VBlank" = ON
Composite: "Refresh Rate" = The same as your monitor refresh rate. No higher.
Workarounds: "Force full screen redraws..." = OFF

Jayson Rowe (jayson.rowe) wrote :

Thanks Daniel.
I do think I have narrowed the issue down (at least in my case) to what John Moodie pointed out above. It seems to be some sort of polling issue - if a browser is trying to refresh something (causing a spinny wheel thingie) or Software Center is installing an application, it happens.

I've been able to minimize the issue by keeping my Chrome tabs under control - I think having a Facebook tab open (which seems to be constantly polling) was the majority of my issues. I haven't been keeping Facebook open in a tab, and the issue hasn't been much of an issue. I have found that if it crops up, a browser restart seems to resolve it. I can deal with this for now (since I think I understand what is causing it...which reduces frustration). And no, I won't switch...I just got back from a distro-hopping escapade - nothing touches the polish of Ubuntu or Unity, and I'm thankful for everything you guys do to constantly make it better :-)

Daniel van Vugt (vanvugt) wrote :

Compiz does use polling to find out when it has to redraw the screen. And it uses even more CPU when it finds out it does have to redraw the screen. That is the code I am looking at right now.

However compiz CPU usage will be much worse if you have changed any of the settings in comment #43. So everyone reading this, please do check those settings.

IbeeX (ibrkanac) wrote :

same preoblem running 11.10 ATI free drivers compiz is about 50%

IbeeX (ibrkanac) wrote :

my problem was in Empaty internet Messaging it was trying to connect to MSN account, after disabling MSN compiz idle cpu is now about 5%

Daniel van Vugt (vanvugt) wrote :

Most of the compiz CPU usage problems should be solved when a fix for bug 861061 is released.

Also, I have made significant progress reducing compiz CPU usage in my proposed fix for bug 880707.

Please keep an eye on both those bugs because I think most of the compiz CPU usage problems will be resolved by those being fixed.

Luke Hoersten (lukehoersten) wrote :

@Daniel any idea when those bug fixes will be released?

Daniel van Vugt (vanvugt) wrote :

I've completed the fix for bug 880707, but it's still awaiting review which could take several weeks still (this is a slow time of the release cycle for reviews). When it's been accepted then I'll put that fix in my PPA for immediate testing by everyone. It's a bit too dramatic a change to propose as an oneiric-update.

Bug 861061 is likely to represent much more of the CPU usage though. And I am aiming to start on a fix for that this week. Then it will be in my PPA within a couple of weeks and hopefully also in oneiric-updates.

These are incidental fixes which just happen to reduce compiz CPU usage. I haven't even trying profiling for the main CPU hog in compiz yet.

max (max-illis) wrote :

I received various updates today - both kernel and compiz, but still have performance problems - I believe related to this thread...

However I can easily replicate my main issue: when I launch an app and (with wobbly windows enabled) 'shake' the window the animation is very smooth.. If I then release the window and try exactly the same movement the movement is very very jerky.. and CPU usage goes through the roof.. As long as I don't release the window everything is fine (!). This is the same for all windows - apps and nautilus: Initially everything works beautifully, but after the initial movement everything is jerky and slow

any ideas?

(- I also have considerable CPU usage - 16% at idle currently (on a quad core CPU) - this might have marginally improved after the update)

Johan Jeppsson (johjep) wrote :

Is there any progress for this? I have installed all the latest updates and still have the problem. It always appears a while after boot up, and ultimately forces me to reboot as videos can become nigh unwatchable. It's really annoying.

Daniel van Vugt (vanvugt) wrote :

I think this bug has become confused.

Compiz using high CPU when the screen is idle is definitely a bug and should be what this bug is all about. But using higher CPU than idle while moving windows or playing video are not unusual, because compiz is the process responsible for rendering EVERY pixel on your screen. Compiz is the compositor for Unity.

That said, I did create an experimental optimization for the compiz "move" plugin the other day that more than halved the CPU while moving windows. It's still experimental.

Please test my PPAs which contain proposed performance enhancements for compiz and unity. Generally the Unity plugin is the largest contributor to compiz' CPU...

ppa:vanvugt/compiz | https://launchpad.net/~vanvugt/+archive/compiz
ppa:vanvugt/unity | https://launchpad.net/~vanvugt/+archive/unity

Changed in compiz-core:
status: New → Confirmed
Changed in compiz (Ubuntu):
status: New → Confirmed
Daniel van Vugt (vanvugt) wrote :

Please also try logging out, and then logging in as Guest. Don't just switch users, but log out before logging in as guest and let us know if compiz continues to have high CPU while the guest desktop is idle.

Luke Hoersten (lukehoersten) wrote :

Thanks for the update Daniel. I'll try your PPA ASAP.

Correct me if I'm wrong, but even though compiz is the process responsible for rendering ever single pixel, shouldn't that be done on the GPU instead of the CPU?

Daniel van Vugt (vanvugt) wrote :

Yes indeed. Most of the hard work is already offloaded to the GPU. But I haven't been working with the compiz code for that long... there are probably quite a few things that can be significantly improved that I haven't discovered yet.

Johan Jeppsson (johjep) wrote :

Okay Daniel, I've installed your PPAs. I'll let you know if I see a difference.

Just to clarify my last post. When I start my computer, I have no problems whatsoever with viewing videos, switching workspaces, moving windows. Compiz then uses very little CPU at idle.

After a while, suddenly everything becomes sluggish and the idle CPU usage shoots through the roof.

Johan Jeppsson (johjep) wrote :

Also, I've noticed that npviewer.bin tends to have very high CPU usage when the problem appears. I've understood that this might be related to flash. Is this correct?

Daniel van Vugt (vanvugt) wrote :

I believe the issue with gradual performance degradation is best discussed in bug 770160 or bug 888039.

Yes, npviewer.bin is likely to be the flash plugin. Not related to this bug.

Johan Jeppsson (johjep) wrote :

I checked those bugs, and one of the workarounds, "unity --replace" works for me. The CPU usage goes back down to normal levels after that, at least temporarily.

Jayson Rowe (jayson.rowe) wrote :

I think the biggest problem with this bug is Ubuntu is using Compiz for it's window manger in Unity - I think almost everyone here is seeing a slightly different problem, and perhaps, everyone who thinks this bug affects them is encountering a separate bug. For example, I only saw the problem when some polling scenario was happening - for example, if I have a pinned tab in Chrome that gets a notification, causing the tab to pulsate, instant CPU spike. Perhaps that wasn't the only thing causing it, but if it wasn't; separate bug (IMHO, anyway).

I'm not experiencing the bug any long because on the affected system, I reloaded Windows 7. However, I have Ubuntu loaded on an HP Laptop and a Dell Mini 9 netbook, both running Unity, and neither seem to be affected by this bug. Compiz is very inconsistent it seems, and I really wish there were a better solution for the Window Manager in Unity.

Daniel van Vugt (vanvugt) wrote :

Yes it's very common that people subscribing to bugs all have slightly different problems. And we should all be aiming to disambiguate the issues as much as possible.

As stated in comment #53, I think this bug should be specifically about compiz using high CPU when the screen is "idle". High CPU when doing something else like moving windows or specific apps should be separate bugs.

James Tunnicliffe (dooferlad) wrote :

Re: Comment 37.

I have installed your PPA. Last night things seemed to be going fine, but this morning (post another reboot) I have compiz taking up 20 - 30% of a CPU when I am not interacting with any running programs. Disabling the Unity plugin reduces its usage to 2 - 3%.

I am running a Lenovo T410 with an NVS 3100M (256MB RAM), running driver version 290.10 and have DynaicTwinView disabled so the driver reports the correct refresh rate to other programs running in the system (this helps).

Daniel van Vugt (vanvugt) wrote :

Please also provide a screenshot of your idle desktop, if possible. That should let us know if something is slightly different about your setup that could help us test and reproduce the bug.

JP (vectorpoem) wrote :

Here's a shot of my desktop, running little else besides htop in a terminal, with compiz CPU usage at 6%.

Ubuntu 11.10 32 bit, with an AMD 4600 X2 CPU and an Nvidia GT 240 running the latest drivers from the repository.

I just discovered that for me Emphaty is causing at least part of the problem.

After startup I see Compiz at around 1-2% cpu while doing nothing.
And then I start Emphaty and now Compiz consumes around 15-16% of cpu.
I then disabled the "People nearby" which did not seem to ever "connect" and voilà,
Compiz is back at consuming only 1-2%cpu!!!

This change also had the benefit that the ever spinning "trying to connect" indicator
on the right of the availability dropdown only shows when I am actually connecting.

However, it remains to see if this also stops the slowly increasing of cpu cycles for
Compiz that I have seen previously. After a couple of days I have seen Compiz
consuming up to 35% of cpu, but maybe this has been a consequence of the Emphaty problem.
I will report again regarding how Compiz behaves after a couple of days.

James Tunnicliffe (dooferlad) wrote :

My discovery of the day: PyCharm (java) being open and not minimized triggers compiz to use 15 - 25% of a CPU on my system. Without it I idle at 1 - 2% use by compiz.

I am using the nvidia binary drivers and have disabled refresh rate detection (detects 50Hz, which is wrong, even with DynamicTwinView disabled) and manually set the refresh rate to 60Hz. This helped things run more smoothly. I also have turned on KDE compatibility.

I have the Java Window Fix and Java Taskbar Fix ticked (default). Disabling these fixes doesn't help. I am using Sun Java 1.6.0_26, 64 bit.

Lenovo T410 with an NVS 3100M (256MB RAM), running Nvidia driver version 290.10.

Ruben Verhack (ruben-verhack) wrote :

@vanvugt Thanks for the PPA! At the moment, it seems that it has fixed my problem. Compiz running fine < 10% (used to be 40%), after pushing my graphics card my GPU temp was 100°C, nog only about 65°C.

A huge improvement. Thank you for that! However, the update does cause the screen to flicker once when I change workspaces. But this is only a small price to pay for the moment.

I also upgraded to Catalyst 11.12 yesterday, however before I used your PPA, the situation was not fixed. I will report if it gets worse again.

Ruben Verhack (ruben-verhack) wrote :

As reference: my machine is a Dell Studio 1558, i5 @ 2,40 GHz, AMD HD 5470 graphics card, 8GD DDR3 memory

Daniel van Vugt (vanvugt) wrote :

Ruben, if ppa:vanvugt/unity fixed your CPU issues then you probably had bug 861061 which could also cause high CPU.

If it was ppa:vanvugt/compiz that fixed most of your CPU issues then I am unsure which change is helping you. But I would like to know... If the CPU was high only when moving windows then that is bug 764330 which is fixed in ppa:vanvugt/compiz. Otherwise I'm not sure which change reduced your CPU usage.

Certainly the change in GPU temp strongly suggests it is the fix for bug 861061 helping you the most.

max (max-illis) wrote :

Dan,
Adding your PPA seems to have solved my high CPU issues - and the issue I had with lagging windows while moving them

thanks very much!

Daniel van Vugt (vanvugt) wrote :

max, that's great news. Could you please let us know if ppa:vanvugt/unity is fixing the problem by itself or if you only see an improvement in CPU with ppa:vanvugt/compiz too.

max (max-illis) wrote :

I added ppa:vanvugt/compiz,

CPU still seems higher than it probably should be - ~20% across 4 cores, but without the lag it 'seems' better

I'll add ppa:vanvugt/unity and let you know

Ruben Verhack (ruben-verhack) wrote :

@Daniel: I'm also looking into which package solved my problem. But maybe I was suffering from two bugs.

Adding the compiz PPA smoothened my whole desktop experience a lot (but introduced the flickers as I was talking about), the unity PPA helped lowered my compiz usage and GPU temp. I'm not a lot at my laptop this week, so that's causing the delay. Didn't do much so, the changes were more subtle. I also reverted my Catalyst driver back to 11.8 for a better comparison. I will get back when I'm entirely sure.

Johan Jeppsson (johjep) wrote :

Yes, I also have the problem with flicker during workspace change after adding the PPA. But as Ruben says, it is still worth it for the performance improvement.

Bernie Innocenti (codewiz) wrote :

@Johan: are you using the Rotate Cube plugin? I'm also seeing a short flicker at the end of the rotation, also with the official compiz package from oneiric.

Johan Jeppsson (johjep) wrote :

No, I am using the standard workspace configuration with 3D unity. I use a 3x3 grid if that matters.

Luke Hoersten (lukehoersten) wrote :

Something else I've noticed (without the new repos) is that compiz/unity gets slower and slower as time goes on without a restart. For example, eventually dash and that app switcher start having multi-second delays and the animated workspace switching stops being animated because the framerates are so low. As we've talked about above, I'm not sure if this issue is related or not but I'll be testing it with the new repos.

Ruben Verhack (ruben-verhack) wrote :

@lukehoersten This is something I also noticed (without the new repos), with the remark that this became more significant AFTER heavy operations (backups, compiling, high-CPU image processing).

So even after these processes had completely terminated, this slowed down the responsivenes of my entire desktop (unity) permanently. (So it was not caused by swapped out processes, I even set swappiness to 10 instead of default 60).

Bernie Innocenti (codewiz) wrote :

@lukehoersten: I noticed that too. For example, when you grab a window from the title bar, there's a delay of about 1 second before you can start dragging it around.

I can reproduce this easily on a Thinkpad X201 (Intel Arrandale graphics), but it takes a lot longer on a Thinkpad X220 (Intel Sandybridge graphics). So perhaps it's related to how much video memory you have?

Luke Hoersten (lukehoersten) wrote :

@vanvugt Unfortunately the problem has not been fixed in the new repos for me. Still hovering around 25+% while idling with Chrome open. I'll leave the box running for a few days to see if it still has the time degradation problem.

Daniel van Vugt (vanvugt) wrote :

Luke, the issue with gradual degradation over time is bug 888039 and/or bug 770160.

For the record, no fix has been put forward for this bug yet. Those who have reported improvements I think are either a lucky minority, or were mostly suffering from bug 861061 (which could severely affect CPU with some gfx drivers).

Luke Hoersten (lukehoersten) wrote :

Daniel, makes sense. Based on the previous discussion I wasn't sure if we'd determined whether or not this actually fixed all the known issues. Merely confirming it does not.

An update: after leaving my computer running for over 24 hours, compiz is sitting firmly at 60%+ CPU while doing nothing on the computer and using the test PPA repos.

Richard Bailey (bailey937) wrote :

I have a Dell Mini 10v (atom N270, Intel GMA 950 graphics) running 11.10 and Unity.

I sshed into it from another machine and ran top.

If I have gnome-terminal maximized and sitting at the shell prompt, then compiz consumes a steady 2% cpu.

If I have firefox maximized (like right now with this page's tab showing), compiz consumes a steady 3% cpu.

If I play a video in vlc or smplayer, then compiz consumes 17-18% cpu constantly.

I don't understand why compiz needs to consume even 2 or 3% cpu when doing nothing (firefox does the same, btw).

And I really don't undserstand why it needs to consume 17 or 18% cpu when I'm playing a video and not doing any window management.

Daniel van Vugt (vanvugt) wrote :

Compiz is not a "window manager" in the traditional X11 sense. Technically unity-window-decorator is the window manager in Ubuntu. Compiz is a compositing window manager, which despite sounding similar is very different.

Compiz is responsible not only for the desktop effects, but for rendering every pixel of every window on the screen. All rendering is proxied through compiz so it can apply any effects to any part of the screen. So that's why compiz uses some CPU while any part of the screen is changing.

But I'm sure compiz could do better, which is what this bug is all about. Certainly an unchanging desktop should result in compiz using zero CPU. And there are probably more parts of compiz that can be optimized to use less CPU. If only someone has the time to look into this bug more closely...

Richard Bailey (bailey937) wrote :

Thanks for explaining what compiz really is.

I'm sure it's not an issue for people using "real" cpus. But for me on my atom n270 netbook, I just can't spare the cycles.

I've switched to lubuntu desktop. I like it it. I think Unity 3D is nice, and it was quite usable even on my hardware. But lubuntu is even better.

Daniel van Vugt (vanvugt) wrote :

I have an N270 netbook I'm testing performance fixes on too. With that hardware I found the best performance (by far) is with:

1. Install ppa:vanvugt/compiz
2. Install ppa:vanvugt/unity
3. Open ccsm and in Workarounds set "Force full screen redraws..." = ON

With any luck, steps 1 & 2 will be built into Ubuntu 12.04. Step 3 is an unknown and requires more testing before it can be made the default. Because full screen redraws only became feasible and improve performance after you have the fixes from the PPAs.

Daniel van Vugt (vanvugt) wrote :

Although that may be slightly off topic, because #3 only improves graphics speed and smoothness, while probably making CPU usage higher.

cmavr8 (cmavr8) wrote :

#87 fixed it for me! Thanks. It should be implemented upstream though...

Thanks Daniel

Daniel van Vugt (vanvugt) wrote :

Those PPAs contain several performance fixes, most of which are upstream already (which means they should appear in precise by at least beta-1).

Regarding CPU usage, a recent fix for bug 888039 might be the solution a few of you were waiting for. The fix for bug 888039 is already in ppa:vanvugt/unity.

Nipas (nik8pol) wrote :

I Just installed the above mentioned repos(vanvugt/compiz&Unity) and updated my system.
This fixed the bug but now a NEW BUG has occured:
~~When grabbing a window and moving it randomly, the pointer does not stay where it "grubed" the window but goes to another place either inside or outside the window.
     This happens either when grabbing the window from the unity panel and anmaximizing it by dragging , or just when dragging a non-maximized window.
Can you confirm this?
Note that it does not occure always so you need to "play" a little.

Daniel van Vugt (vanvugt) wrote :

Nipas, you are describing bug 903846 and/or bug 201681. And I think there are probably duplicates of each still floating around in LaunchPad.

Daniel van Vugt (vanvugt) wrote :

Also, if you're sure the bug is new then it could also be bug 923683. You will only see that one with my PPA and pre-release binaries.

Nipas (nik8pol) wrote :

Daniel van Vugt, i am pretty sure that this bug occured just after enabling your repositories , so this should be the bug #923683 as you mentioned.
Thanks !

Omer Akram (om26er) wrote :

Nipas, that really happened before the Daniel's ppa, its a known issue.

Changed in unity:
importance: High → Medium
Changed in unity (Ubuntu):
importance: Undecided → Medium
Changed in compiz-core:
importance: Undecided → Medium
Changed in compiz (Ubuntu):
importance: Undecided → Medium
Daniel van Vugt (vanvugt) wrote :

All, I believe most of you will find you had bug 888039 instead of this one.

Also, today I have proposed a new optimization which HALVES compiz CPU usage. Subscribe to bug 940139 if you want news on that.

Luke Hoersten (lukehoersten) wrote :

@Daniel: On 12.04, it looks like my idle compiz CPU utilization went down from 51%+ to about 15%. While it's a huge improvement, shouldn't it be much lower as computations can be done on the GPU?

Daniel van Vugt (vanvugt) wrote :

Luke, yes that's the theory that using the GPU should free up the CPU. However compiz still has some performance bottlenecks that will impact the CPU, often more than Unity-2D. I hope to have time to improve this in the future.

Leonardo Borda (lborda) wrote :

Happens to me too on a LG Laptop

System Information
 Manufacturer: LG Electronics
 Product Name: R405-G.CP02A9

$ glxinfo | grep OpenGL
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) 965GM
OpenGL version string: 2.1 Mesa 8.0.2
OpenGL shading language version string: 1.20

Zookalicious (chrishylands) wrote :

12.04 still has issues with this. I accidentially created the duplicate Bug #975372, however is contains hardware information if that helps at all. Typically with a couple windows open compiz sits between 30 and 50% of my CPU usage when it rarely went over 5 in 11.04 / 11.10

Vasile Rotaru (vrotaru-md) wrote :

I had that issue too. I can certainly confirm that compiz is doing a lot fo polling. I learned it through

sudo strace -p ${compizPid}

A related bug revealed by 'sudo strace -p ..' is that it hangs my box (Ubuntu 12.04) in two cases of three. Not fun.

Vasile Rotaru (vrotaru-md) wrote :

Leaving a terminal window with htop running, I've noticed an interesting detail related to compiz CPU consumption patterns. The Clementine player does it!

Seriously, when the Clementine is not launched, or launched but not vissible the compiz CPU% stays within reasonable limits (0%-3%). But when Clementin is launched the CPU% jumps to 30%-60%. All that with no other activity.

Now, that I think of it, it could be a QT thing. Hiding Clementine and launching Bitcoin-Qt raises the compiz' CPU% to 18%, which was drawing a progress bar and a spinner.

Now have both those applications minimized and compiz' CPU% is 1%-7% . With no other activity. Hope it helps

cmat (cmat555) wrote :

After the recent update to Unity 5.10, preformance on my laptop seems to have degraded. This is espacially noticable when I have Unity's dash in maximised mode (my prefered mode). I had to switch over to Unity 2D (which is excellent BTW) for the time being. Compiz idles at about 25% CPU. Under Unity 2D, the system idles near zero. It also runs a lot cooler than before. Using nVidia proprietary drivers (recommended by the driver installer).

Daniel van Vugt (vanvugt) wrote :

All - While compiz is using high CPU, please run this command _several_ times:
  sh dstack compiz >> stacks.txt

And then attach the file "stacks.txt" to this bug.

Ingo Gerth (igerth) wrote :

That is not possible I get the message
"sh: 0: Can't open dstack". The results stack.txt file is empty.

Daniel van Vugt (vanvugt) wrote :

Sorry, you need to use an exact path to the dstack file you downloaded:
sh ./dstack ...

Felix Haller (felixhaller) wrote :

i can confirm that unity 5.8 was more responsive than 5.10 is (especially the dash).
i executed the script while opening and closing the dash and attached the file.
hope it helps.

Daniel van Vugt (vanvugt) wrote :

Try again, this time with the missing dstack script...

All - While compiz is using high CPU, please run this command _several_ times:
  sh dstack compiz >> stacks.txt

And then attach the file "stacks.txt" to this bug.

Daniel van Vugt (vanvugt) wrote :

Ingo, All, the "dstack" script is attached to comments #104 and #108, but is invisible apparently due to a Launchpad bug. Please click on either the #104 or #108 links to get the dstack script.

Jack Deslippe (jdeslip) wrote :

Hi Daniel,

I have this problem on a MacBook air with latest 12.04. Compiz/X.org are often at 50% CPU. My desktop with a different NVidia Card doesn't seem to have this problem. At least not nearly as bad.

I have attached my stacks.txt to the bug in case that is helpful...

Is there any compiz log I can look at to see what it is doing during these times?

-Jack

Alfred Zhu (yuezhu) wrote :

I am also experiencing the same problem on ThinkPad T410 now. I am not sure if it is related to the nvidia current driver shipped by Ubuntu 12.04. Anyway, this problem influences me severely as the high CPU usage results in fan frequently working at high speed, making a loud noice and reducing the longevity.

Ingo Gerth (igerth) wrote :

Alfred, please try running the script then.

Daniel, yesterday I tried running the script but it threw some error messages. I then tried running it as root but that crashed my system. Attaching the little output anyway.

mthome (mthome) wrote :

The attached stacks.txt is representative of the majority of runs of the dstack script on my machine while it is exhibiting this behavior (vanilla 12.04 as of today). Top reports a loadav of 1.57 with what should be a mostly idle system with compiz as the largest cpu consumer 30% with nothing else above 10%.

There's a clock widget on my desktop (with an incremental second hand). Killing the thunderbird instance (with a spinning throbber) drops compiz cpu use to 6% (still with a similar typical dstack output)

Ingo Gerth (igerth) wrote :

This what I get when I enter the command for the script. At the moment I have a few windows open: 4 terminals, Banshee, Firefox, Nautilus, the System Monitor, and two Evince instances. On idle the CPU consumption of my i7 Sandy Bridge CPU is 30% right now.

Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
/home/ingo/2498: No such file or directory.
Thread ID 1 not known.
/tmp/dstackscript23002:4: Error in sourced command file:
No stack.

Daniel van Vugt (vanvugt) wrote :

Thanks all. There's no need for more attachments.

It seems that approach to debugging this problem is inappropriate. Repeated stack dumps like that only show the most common stacks based on wall-clock time, not CPU time consumed. So they're all generally showing wait functions, which use most of the wall-clock time in compiz, but none of the CPU time.

I will need to put together a document describing how to profile Compiz properly in order to get more useful data...

autra (autra) wrote :

Also affects me in vanilla 12.04, but only with a Nvidia card. At home I have a ATI card and CPU usage is ok (around 1-5% when idle).

autra (autra) wrote :

I have submitted #989035 (https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/989035)

Do you guys think it's the same issue ?

schiebe (schiebe) wrote :

Hello,

i also have recognized the same behavior. My load-level at idle goes not under < 0,3. Sometimes i have > 1,0 and nothing special is running regarding to top.
With 11.04 and Gnome i has about 0,0x.

Also the fan runs now more frequently.

It runs on a Dell Vostro 1510.

$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8400M GS/PCIe/SSE2
OpenGL version string: 3.3.0 NVIDIA 295.40
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL extensions:

Please let me know if someone needs more information.

Michael (mstrelan) wrote :

For me this seems to be a problem ~40% CPU while actively using browser, and the same while away from the computer if I left the Facebook tab open. Closing the Facebook tab reduces the compiz CPU significantly.

Jooj (jooj) wrote :

Same problem here.
Compiz don't use a lot of cpu idle (2% constantly), but the smallest action take a LOT of cpu.
A simple tab in chrome whith a notification animation takes 50% of the cpu (because of compiz), a simple tab changing, a simple scroll, a simple dash open...

 In Ubuntu 11.10, compiz used 8 to 15% idle (so it's a lot better now), but a simple action didn't take such cpu consumption. Now my fans are crazy when I do a simple google search. It's not a medium importance bug, it's a HUGE problem.

It runs on a Dell Vostro 1320.

glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8400M GS/PCIe/SSE2
OpenGL version string: 3.3.0 NVIDIA 295.40
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL extensions:

Philippe (raptor200357) wrote :

Oh yeah, never been under 10% at idle.
With Gnome classic I got 2%, and that's way better when playing a video or moving a window.

Please fix this asap, I think that unity in 12.04 is better than previous versions, but this problem is ruining the user experience.
I sometimes regret my old 11.04 for the "smoothness".

Florian W. (florian-will) wrote :

With the rhythmbox window open and rhythmbox playing a song (and the slider slowly moving from left to right), but with the rhythmbox window _NOT_ visible, compiz consumes ~10% CPU constantly (Firefox at full screen, two gnome terminals [top & dstack] in front of it).

dstack seemed to indicate that "waitforvideosync" (sp?) is (almost, behind some fglrx calls, and ioctl at the very top) at the top of the stack pretty often. That's expected I guess, but I wasn't sure if ioctl can be used to block a thread, so I unchecked the vsync option in ccsm. compiz CPU usage is now down to ~3% with vsync disabled and rhythmbox not visible.

slow scrolling in firefox with vsync enabled: ~50% compiz CPU usage
slow scrolling in firefox with vsync disabled: ~16% compiz CPU usage

I'm not sure what to think of this. Busy waiting for vsync in fglrx? Or is the lower CPU usage just some side-effect in compiz caused by disabling vsync?

Daniel, thanks for your efforts to improve compiz. :-)

Daniel van Vugt (vanvugt) wrote :

Thanks Florian. It sounds like your graphics card and driver is so fast that maybe compiz is rendering multiple frames per physical frame. That's unusual but I can imagine it might be possible with fast graphics and the new compiz rendering method in 12.04.

Can anyone else confirm the CPU usage drops significantly when vsync is disabled?

To disable vsync...
1. Run "ccsm" (from the "compizconfig-settings-manager" package)
2. Go to the OpenGL section and untick "Sync To VBlank".

Nipas (nik8pol) wrote :

I can confirm that CPU usage drops significally when vsync is disabled. To be specific:
Vsync enabled: When computer is completely idle compiz cpu usage is 1-2 %
                            When dragging the terminal window gently compiz cpu usage is approx. 30-35 %

Vsync disabled: When computer is completely idle compiz cpu usage is 0 %
                             When dragging the terminal window gently compiz cpu usage is approx. 15%
                             The bad thing is that disabling vsync causes other significal problems such as not smooth window moving!

Changed in compiz-core:
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in unity:
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in compiz (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in unity (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Jack Deslippe (jdeslip) wrote :

I can also confirm that when compiz is using up a lot of resources disabling vsync reduces CPU usage about 50% - almost instantly. But, even with this reduction compiz still uses a lot of cpu when chrome is open and doing nothing...

Jooj (jooj) wrote :

I confirm that disabling vsync reduce cpu usage of compiz (35 -> 8 while scrolling for compiz). But Xorg use always a lot of cpu, so the global cpu reduction is not that spectacular.

 The only disadvantage I see is when I move a windows (not as smooth). Other animation like "scale" mode are unchanged.

Andrii Vozniuk (andrii) wrote :

I do confirm the bug. Right after installing Ubuntu 12.04 top showed 25% average CPU usage for compiz. After disabling vsync the average CPU usage dropped to 5%.

I can also confirm that disabling vsync results in low cpu usage in unity. Dropped from about 40% to 5% when moving windows.
What do you need vsync for anyway? The applications take care of their window content being in sync themselves.

Karl Frisk (karl-frisk) wrote :

I can not confirm that disabling vsync would help. with and without vsync compiz consumes 20%-25% cpu when i move a small window around.

btw, dimitri, vsync is an essential technique in computer graphics to prevent tearing ( http://en.wikipedia.org/wiki/Screen_tearing ) but it never really worked for X11. Ubuntu 12.04 is the first release that really reduces tearing but now we have this cpu issue. :(

cicoandcico (cicoandcico) wrote :

I can not confirm that disabling vsync would help, too.
Dell D830 with Nvidia NSV140M (similar to 8400) and proprietary drivers (295.40).

CPU usage while slowly moving windows goes from 60% to 10%.

cicoandcico (cicoandcico) wrote :

Sorry, I was meaning: I CAN CONFIRM THAT that disabling vsync would help, too.

isden (isden) wrote :

Disabling vsync on my laptop (HP pavilion dv7 with Intel SB + AMD HD6770m, currently the Intel GPU is used) does nothing.
Compiz consumes the same 7-12% of CPU (it was about 1-2% before).

autra (autra) wrote :

Disabling vsync worked for me !
Compiz dropped from 10-20% CPU to ~5%

Leuke (leuke) wrote :

Enabling vsync in my netbook (nvidia Ion platform) causes a major increase in cpu usage, and as side effect every application has a lower framerate, it is particularly evident in video clips.
Disabling it, everything becomes smooth.

Paul Smith (psmith-gnu) wrote :

Just to point out, compiz using a constant 5% of CPU time can only be considered "good" in comparison to compiz using a constant 10-20% CPU time. If there's nothing happening on the screen then compiz should be essentially completely idle and using much less than 1% of the CPU time, if any. A constant drain of 5% busy is a disaster for power savings, battery life, heat, etc., at the very least.

It's definitely possible for compiz to use essentially no resources when idle. That's how it used to work...

isden (isden) wrote :

It seems that the issue is related to https://bugs.launchpad.net/ubuntu/+source/indicator-multiload/+bug/996273 .
When I quit from the indicator-multiload, the compiz CPU usage reduces from 10-12% to 1-3%.

xir (simonbennie) wrote :

this is affecting me too. Compiz goes mad upon opening chromium.

12.04, 2:8.960-ubuntu1 amd graphics driver. (4000 series gpu).

Changing Vblank in CCSM doesn't improve the CPU usage. Nor does making amdccle wait for vertical refresh.
Enabling tear free desktop does not have any affect either.
Nor does enabling/disabling catalist AI.

Without Vblank however the dash is MUCH more sluggish, to the point of not being usable.

Attached is the messages from a stock unity configuration when launching chromium, I think some of it may help.

xir (simonbennie) wrote :

unity --replace whilst launching chromium

gentmatt (gentmatt) wrote :

I'm experiencing this as well in a fully patched Ubuntu 12.04 install on a MBP 8-2 early 2011.

01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI Seymour [Radeon HD 6400M Series] [1002:6760]

raxetul (raxetul-gmail) wrote :

Same issue with ATI 6870 in Ubuntu 12.04 64 bit with both drivers from repos and from AMD. While playing a (not hd) video whole OS was frozen I could not drop into shell with pressing ALT+CTRL+F1/F2/...

raxetul (raxetul-gmail) wrote :

By the way I can help, with debugging reports if you want but first you should tell me which packages are needed for perfect reporting.

Daniel van Vugt (vanvugt) wrote :

All, FYI, there are many different reasons why compiz uses lots of CPU in some cases. Often Unity is the cause, and often it's an indicator (like multiload -> bug 784055). There is also still some overhead in inefficient rendering that could be improved.

I think this bug has just become a general discussion forum, making it highly unlikely that a single cause will be cited and agreed upon.

Instead, if you can find that something in particular causes compiz to use high CPU, or can find something that prevents it, then please log a separate bug about each particular issue. That way each problem is likely not be triaged and fixed in a more manageable way.

Daniel van Vugt (vanvugt) wrote :

"That way each problem is likely to be triaged and fixed in a more manageable way.", I mean.

Jack Deslippe (jdeslip) wrote :

Daniel. So what is the procedure for generating useful debugging info. You said above your dstack script is not useful. I'd love to get debugging info to you.

-Jack

Marius B. Kotsbak (mariusko) wrote :

Seems I got this problem after enabling more effects in ccsm.

Daniel van Vugt (vanvugt) wrote :

OK, here's a quick guide to recording a performance profile of compiz that we might be able to use...

1. INSTALLATION
sudo apt-get install linux-tools-common
Then you also need the package specific for your kernel. You can find out what it is called by running "perf". That will tell you what you need.

2. RECORD PERFORMANCE
Start this and let it run for a while:
    perf record -p `pidof compiz`
Then stop it with Ctrl+C.

3. CREATE A REPORT
In the same directory (where perf record created file 'perf.data'), run:
    perf report > compizperf.txt

And attach the file compizperf.txt to this bug.

It's quite possible that this kind of simple flat profile won't help us. If that's true then you just need to add the -g flag to the perf record command. But don't do that yet.

Changed in compiz:
assignee: nobody → Daniel van Vugt (vanvugt)
importance: Undecided → Medium
status: New → Confirmed
HB (hiddenbayes) wrote :

I'm experiencing the same issue. The report I got from running the commands Daniel listed is attached.

cicoandcico (cicoandcico) wrote :

Here is attached my perf report.

Karl Frisk (karl-frisk) wrote :

here is my perf report. it was generated on the machine being entirely idle except for audacious playing an mp3.

Karl Frisk (karl-frisk) wrote :

I did some more testing and now I am sure the problem is not unity/compiz specific. My guess is that it is related to Xorg itself.

In Unity2D, just moving a small window around brings the Xorg process to consume 20% CPU. In a XFCE session, moving such a window makes Xorg consume over 50% (!) CPU.

Xorg should be added to the affected packages, imho.

Daniel van Vugt (vanvugt) wrote :

Karl, all window management such as moving windows will cause some activity in the Xorg process. But this bug is about Compiz only. If you find performance issues with Unity2D and Xorg then feel free to log separate bugs about that.

Daniel van Vugt (vanvugt) wrote :

Sorry all...
My instructions for using "perf" are inadequate and not generating good data. Please ignore them until I come up with better instructions (or you figure out something better :)

Ben Gamari (bgamari) wrote :

It would be easier to contribute if you could relate exactly how the data collected by perf is inadequate. Are you worried about the time spent in kernel mode (as seen in https://launchpadlibrarian.net/105617534/compizperf.txt and https://launchpadlibrarian.net/105624580/compizperf.txt , although this could be tough given the binary blob in use)? Do you not see any hotspots you would expect (nothing too damning in two of the profiles)? Other concerns? Do you have any hypotheses or suspicions for what might be chewing up CPU time? Knowing what you expect from the profile would help us a lot in providing the data you need.

Daniel van Vugt (vanvugt) wrote :

Ben, the data is inadequate because perf is failing to relate unity and compiz functions to the high CPU usage listed next to the kernel and nvidia driver. This does not mean the kernel or nvidia are to blame. It just means that the perf tool does not have enough information to get usable call stacks relating the high CPU usage to the areas of unity and compiz causing it.

I believe the solution to this is probably to install debug symbols for the unity and compiz packages. If you know how to do this then please try. If not, then please wait till I have written some better instructions.

I am also experiencing this issue with a fully up-to date Ubuntu 12.04. My CPU for compiz at idle is always atleast 16%. When I restart the machine it goes back to sensible levels for a while. I can tell when It goes up again because windows don't move smoothly and my whole system seems laggier and less responsive and applications seem to take slightly longer to run.

autra (autra) wrote :

Chris, does the workaround in #989035 helps ? (Disabling Vsync in Compiz Config Setting Manager)

I installed Compiz Config Setting manager (compizconfig-settings-manager) and disabled "Sync to VBlank" and idle cpu jumped from 16% to 5% straight away. Success! Thanks for that Autra.

For the record Im running a Nvidia NVS 3100M with 2 screens.

xir (simonbennie) wrote :

Daniel, an alternative route to go would be to look up the number of wakeups the Compiz is causing rather than raw CPU usage. Similar to the output from powertop.

When you mentioned installing the debug symbols did you mean a compiz-debug package in the repositories or something more?

Simon

Ben Gamari (bgamari) wrote :

Daniel,

Having experienced this bug in the past myself, I would be happy to collect more profiling data. Unfortunately I'm running your pre-proposed PPA at the moment for which it seems there are no debug symbols. I'll downgrade back to the stock package and install debug symbols as soon as I am able. I'm assuming the following packages will be sufficient (correct me if I have missed anything),

libunity-dev-dbgsym libnux-2.0-0-dbgsym compiz-core-dbgsym compiz-gnome-dbgsym compiz-plugins-dbgsym libgl1-mesa-dri-dbg libgl1-mesa-glx-dbg libnux-2.0-0-dbgsym

and the appropriate kernel symbols (linux-image-3.2.0-23-generic-dbgsym in my case).

If anyone is interested in trying this themselves, follow the instructions at https://wiki.ubuntu.com/DebuggingProgramCrash, install the above packages, and try collecting another profile with Daniel's original instructions. Moreover, I don't think it should hurt to enable callgraph profiling (-g).

Daniel van Vugt (vanvugt) wrote :

Ben: From what I can tell, Linux perf is not capable of using separate debug symbols to the running binaries like gdb can. It needs you to be running the debug binaries, so the above wiki instructions won't work for 'perf'. According to the Ubuntu convention I believe this means we need -dbg packages built for unity and compiz. The -dbgsym packages won't work with 'perf'.

All: If you did not do so already it is worth doing this before perf record:
    sudo sh -c 'echo 0 > /proc/sys/kernel/kptr_restrict'

That should be the same as running "sudo perf record ..." but without the need for "sudo".

Ben Gamari (bgamari) wrote :

Daniel: I must say that I've never encountered any issues using perf against executables or libraries with stripped debug symbols. While, admittedly, I nearly never strip debug symbols from my own builds, these are still linked against distribution libraries, most of which have separate symbols. While I could be wrong, a quick Google search turns up plenty of evidence suggesting that the separate symbol configuration is supported[1][2][3][4]. That being said, much of this evidence is in the form of bug reports or patches fixing breakage, so you could very well be encountering a known issue.

[1] http://www.spinics.net/lists/linux-perf-users/msg00262.html
[2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/608775
[3] http://www.spinics.net/lists/linux-perf-users/msg01131.html
[4] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=661193

Andrei Dziahel (develop7) wrote :

Hey, it seems I'm affected too: my compiz eats like 35% (up to 60%) of CPU while doing nothing. Here's my compizperf.txt I have just generated.

Andrei Dziahel (develop7) wrote :

And yes, disabling vsync drops CPU usage ~2 times

M.F. Abdollahnia (mfarshada) wrote :

I have the same issue with ubuntu 12.04, unity.

xir (simonbennie) wrote :

I just updated to precise proposed. unity 5.12.0ubuntu1.1 and compiz is FAR better now for me. It is idling around 2% CPU instead of 30% when chromium is open.

Well done guys.

Daniel van Vugt (vanvugt) wrote :

xir, if 5.12-0ubuntu1.1 fixes your problems then you probably had bug 987304, or performance problems related to one of the other optimizations done in that update.
[https://launchpad.net/ubuntu/+source/unity/5.12-0ubuntu1.1]

xir (simonbennie) wrote :

Daniel. You are probably right. It was just odd the that compiz would only spike with Chromium/Chrome open.

It would be good if one of the other reporters in this bug could try updating to see if they have the same result.

Anton Statutov (astatutov) wrote :

I've just updated three computers from Ubuntu 11.10 to 12.04. All have different ATI cards with drivers installed, and all have high cpu consuming by compiz. Though I haven't noticed any visible problems on the one of that computers. It's 4-cored notebook where interface responsibility isn't touched by this problem. Other two are 2-cored PCs and have noticeable interface lags compared to Ubuntu 11.10, making they almost unusable.

Anton Statutov (astatutov) wrote :

I just updated three computers from Ubuntu 11.10 to 12.04. All have different ATI cards with drivers installed, and all have high cpu consuming by compiz. Though I haven't noticed any visible problems on the one of that computers. It's 4-cored notebook where interface responsibility isn't touched by this problem. Other two are 2-cored PCs and have noticeable interface lags compared to Ubuntu 11.10, making they almost unusable.

cmavr8 (cmavr8) wrote :

Just to add data to the bug report, on my 4-core (8 threads) i7 setup, with ATI graphics and google chrome, after 5 days my $ top shows:

top - 13:01:41 up 5 days, 19:52, 2 users, load average: 1.13, 1.30, 1.38
Tasks: 292 total, 2 running, 289 sleeping, 0 stopped, 1 zombie
Cpu(s): 11.0%us, 5.3%sy, 0.0%ni, 83.1%id, 0.0%wa, 0.0%hi, 0.5%si, 0.0%st
Mem: 9200596k total, 8530880k used, 669716k free, 147956k buffers
Swap: 0k total, 0k used, 0k free, 3719712k cached

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
 2358 chris 20 0 1676m 152m 26m S 44 1.7 1064:58 compiz
 3054 chris 20 0 2014m 451m 17m S 17 5.0 248:06.63 chrome
 1156 root 20 0 663m 259m 184m S 12 2.9 251:51.52 Xorg
 2945 chris 20 0 957m 167m 7292 S 9 1.9 136:01.27 chrome

Note how much CPU time compiz has used...

Daniel van Vugt (vanvugt) wrote :

I hope this fix will help some people when it's finalized and approved:
https://code.launchpad.net/~vanvugt/compiz/XDamageReport/+merge/108307

Daniel van Vugt (vanvugt) wrote :

Also this performance fix:
https://bugs.launchpad.net/compiz/+bug/1005569

And probably more to come.

When disabling vsync I have an additional problem next to tearing, which makes performance sluggish and increases tearing even more. Ubuntu wrongly thinks that my screens refresh rate is 50 when it is 60. Forcing compositing to 60hz improves the experience a lot. It's probably not as good as vsync, but it's very comfortable. I was never a big fan of vsync though, because it always at's a tiny tiny little delay. it's not instantanously.

Biji (biji) wrote :

thanks #173 did that and cpu usage lower on nvidia 630M

Karl Frisk (karl-frisk) wrote :

Daniel van Vugt, how can we try these fixes out? Is there a PPA that has them?

Daniel van Vugt (vanvugt) wrote :

Karl, the XDamageReport fix (bug 1007299) still needs more development done before anyone can or should test it.

As for bug 1005569, I heard last week that Ubuntu packaging had started selecting backporting some fixes including that one for the next update to 12.04.

Sorry, no PPAs for those.

Daniel van Vugt (vanvugt) wrote :

Dimitri, Biji, regarding comments #173 and #174, that is nvidia bug 92599.

Raymond Wells (rfw2nd) wrote :

I had some success by opening up CompizConfig Settings Manager (Alt+F2, ccsm assuming you have it installed.) and enabling "copy to texture" I noticed the CPU usage on my machine dropped from a hard 10% to about 2% even with programs open. I still find it odd that compiz's CPU usage spikes when I drag windows or sometimes when I have smooth animations in windows despite having the fglrx drivers installed, since it's supposed to be hardware accelerated. Leads me to believe that something is causing it to do more work than it should on the software side.

Raymond Wells (rfw2nd) wrote :

About my previous comment.. For some reason I thought I had installed fglrx on this machine; but it would appear that it is not the case. So the solution in comment #178 may not work.

Raymond Wells (rfw2nd) wrote :

Okay, so I tried messing around with some options, and here's something that worked for me (on fglrx driver):

- The problem goes away when I turn off Sync to VBlank (ccsm, OpenGL section). I don't remember having the high CPU usage while idle, but I did have the usage spikes while dragging windows. On my desktop (Radeon 2600XT), and my laptop (Radeon 4670), turning off Sync to VBlank dropped compiz's CPU usage while dragging windows from 25-70% to around 3-9%.

I found the following workaround to be effective for me on both my desktop and laptop to both get rid of the tearing, and :
(requires proprietary ATi drivers.)
1. Turn off Sync to VBlank in ccsm.
2. Open up the Catalyst control center, (command: amdcccle)
3. Turn TearFree Desktop on (it's under Display Options)
4. Change the "Wait for vertical refresh" setting to "On, unless application specifies." (I had issues with compiz starting up, and changing that fixed it.)

The result will be: compiz running with acceptable CPU usage and no tearing. The only side effect I've noticed is that sometimes while moving windows very rapidly, the cursor will jump and the little hand will become separated from the window it is dragging.

Ashton Fagg (fagg) wrote :

This affects me too. Can confirm that disabling vertical sync helps. Currently using a Dell Latitude E6410 with nVidia NVS3100M running TwinView mode. Performance was utterly atrocious prior to this, with periods where Compiz would hog a whole core. Disabling vertical sync seems to make the machine run much quieter and cooler.

Daniel van Vugt (vanvugt) wrote :

If disabling sync-to-vblank solves your problems then that means the driver is reporting that it "can do" sync to vblank, but then breaking its promise and not doing it when asked. But I'm not sure compiz is doing everything it can to detect such driver behaviour, so won't call it a driver bug just yet.

Nick Maynard (nick-maynard) wrote :

Similarly to @fagg, I have disabled vertical sync. I have noticed idle usage drop from ~52% to ~28%. Which is an improvement.

glxinfo output:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Quadro 1000M/PCIe/SSE2
OpenGL version string: 4.2.0 NVIDIA 295.40

You may want to consider a related problem with the combination Compiz and Clamav. I did an upgrade last week from 10.04 to 12.04. After doing this, I noticed a significant slowdown in the performance, basically it became unusable for work.

Looking at system monitoring, Compiz was somewhere in the range of using 50% of one processor, but more significant Clamav (installed from the repositories in 10.04) was using close to or over 100% of one processor. I could fry an egg on the laptop. I killed ClamAv and then removed it using package manager. This improved things instantly, though I must say I still perceive it to be slower than 10.04.

Since it does not get hot anymore, but overall it is not great.

Hardware: HP Compaq 6720S, HDD320GB, 1 GB ram.

Mark Fernandes (typist) wrote :

This is a problem for me too. After many attempts at doing other things I was able to reduce (not eliminate) load averages from around 50% to 20% by removing VBlank in the CCSM and disabling Vertical refresh in AMD cccle. After I did "unity --reset" I noticed I kept getting error messages but they scrolled away quickly - however I could capture the parts where the error was shown and its below:

(compiz:2409): GConf-CRITICAL **: gconf_client_add_dir: assertion `gconf_valid_key (dirname, NULL)' failed
Initializing unityshell options...done
compiz (core) - Warn: unhandled ConfigureNotify on 0xc00090!
compiz (core) - Warn: this should never happen. you should probably file a bug about this.
compiz (core) - Warn: unhandled ConfigureNotify on 0xc000a1!
compiz (core) - Warn: this should never happen. you should probably file a bug about this.

If you need more info let me know what I should do.
Thanks

Developer (lunixhacker) wrote :

I also suffer on this problem on an ultra high end laptop with an i7 processor and a nvidia quadro 1000M (proprietary driver activated) graphics card running a clean install of the latest 12.10 builds. There are always two processes comsuming a lot of cpu: Xorg and compiz. At Idle both use around 3% cpu. If i do somthing, it doesn't matter if it is snapping a window, resizing a window, launch a programm or watch a video: compiz climbes up to 50% (very often) and sometimes even up to 118 for a second. This should not be the case. Disabling Unity plugin does not help very much, and disabeling sync to Vblank results in tearing (although cpu goes down a bit).
I hope this bug can be fixed till the release of 12.10, because the Unity interface will be nearly perfect right then. This is a really big performance issue with high importance, because it can make users switch. Compiz and Xorg alone are causing very high CPU usage. KDE actually has a bit better performance concerning moving tasks ans especially snapping (compiz often consumes lot of cpu concerning this). When I play a video in KDE X is about 10% and kwin around 1 or 2 %. In Ubuntu Xorg is about 10% and compiz around 10%.
But I have to admit Compiz is making great progress! I hope that 12.10 brings a lighter compiz!

Daniel van Vugt (vanvugt) wrote :

lunixhacker,

The issue with nvidia+Xorg CPU usage is also discussed in bug 973506.

I am personally curious to see if the fix for bug 1007299 helps with your compiz CPU usage. That fix won't hit quantal till at least compiz 0.9.8+bzr3265 (or later).

Developer (lunixhacker) wrote :

Thank you for your reply!
Another thing I noticed (beside the too high cpu in idle and doing simple tasks by Xorg and compiz) is that cpu usage gets up to 10 times higher when only moving the mouse cursor (in idle). This is for sure not normal, if i compare it to other systems.

Ubuntu 12.04 64bit, clean install
noteboot: hp hdx16
video: nvidia 9m

- when i don't touch mouse compiz eats 9%
- when i move mouse - 20 - 30%
- when i move window - 60 - 70%

wtf?

Kim Nguyễn (kim.nguyen) wrote :

This bug makes it particularly painful to use Google Chrome/Chromium as reported here:
http://code.google.com/p/chromium/issues/detail?id=98200

One easy test case:
Enable the compiz benchmark plugin (compiz-plugins-extra)

Open google chrome with two tabs, one blank the other one pointing to:
http://www.lri.fr/~kn/test.html (this is a blank page with a bit of javascript that changes the title of the page every two seconds).
right click on the tab with the javascript code and choose pin tab. Now bring the other, non pinned tab in front. After two seconds.
the pinned tab starts glowing to notify of the title change in the background tab. While the background tab is glowing, one can see
1) compiz renders at 60 FPS, burning between 15% and 20% CPU (depending on the machine I tested on).
2) strace of compiz shows that it is polling the X server socket at a very high rate (see linked bugreport).

I could confirm this on precise, both on my laptop and desktop, both Intel graphic cards.
Disabling V-sync does not help.
Also this does not happen with compiz launched alone.

If compiz is launched alone (just X, xterm, compiz and google-chrome), then compiz stays at a moderate 11FPS when the tab is glowing.

Andrei Dziahel (develop7) wrote :

@kim.nguyen: confirming issue you have described — I'm experiencing it too for a pretty long time already

Andrei Dziahel (develop7) wrote :

@kim.nguyen: videoadapter is nvidia GF 560

This bug causes overheating on my laptop. Beside this it makes 3D game unplayable. I have to use Unity 2D...

luh3417 (raen) wrote :

Seems this Bug is over a year old any idea when it might be fixed? I am running ATI Radeon 3300 on AMD64 4 core Phenom CPU. It used to to run alot faster on KDE.

Bernie Innocenti (codewiz) wrote :

> Seems this Bug is over a year old any idea when it might be fixed?
> I am running ATI Radeon 3300 on AMD64 4 core Phenom CPU.
> It used to to run alot faster on KDE.

The bug was about compiz becoming gradually slower over time, probably due to resource leaks caused by Unity).
This has not been happening for me in a long time.

I think we could close this bug as fixed and open new bugs for any other performance problems that may still exist.

Dilton McGowan II (diltonm) wrote :

>> I think we could close this bug as fixed and open new bugs for any other performance problems that may still exist.

You are wrong, game performance is in the toilet with Unity. Run any game on Unity 3D that lets you check FPS then log out and log into Xfce and run the same game. You will see at least 35% increase in performance.

Unity 2D is slightly better but oddly not that much.

Changed in compiz:
assignee: Daniel van Vugt (vanvugt) → nobody
Changed in compiz-core:
assignee: Daniel van Vugt (vanvugt) → nobody
Changed in unity:
assignee: Daniel van Vugt (vanvugt) → nobody
Changed in compiz (Ubuntu):
assignee: Daniel van Vugt (vanvugt) → nobody
Changed in unity (Ubuntu):
assignee: Daniel van Vugt (vanvugt) → nobody
Daniel van Vugt (vanvugt) wrote :

Yes, there are real performance problems remaining in compiz and unity. We're still working on improving that from several different angles.

I agree with Bernie that overcrowded performance bugs like this tend to never get resolved. That's because:
  1. There are too many people to reach any consensus. So really we need to make the original reporter that sole authority on what works, and everyone who disagrees should log their own performance bugs.
  2. People experience performance problems with different root causes. So they subscribe to a common bug and expect their problem will be solved when someone else's performance bug is resolved.

Performance bugs are almost always too vague and subjective for everyone to agree. So generally we just keep working on improving performance every way we can, with help from peoples' comments, and eventually/sometimes the original reporter will decide the bug is closed. Sometimes.

Dilton McGowan II (diltonm) wrote :

That technique for bug resolution should work too.

Bernie Innocenti (codewiz) wrote :

>> I think we could close this bug as fixed and open new bugs for any other performance problems that may still exist.

> You are wrong, game performance is in the toilet with Unity.
> Run any game on Unity 3D that lets you check FPS then log out
> and log into Xfce and run the same game. You will see at least
> 35% increase in performance.

You're misreading my comment: I never said that compiz and unity are free of performance bugs. I'm saying that the problem described by the original reported is no longer reproducible.

There might already be other launchpad bugs for the constant (non-degrading with time) performance hit that you've observed. If not, please go ahead and file a new one.

As the original bug reporter, I can confirm this bug is now solved *to me* with Ubuntu 12.04 (unity version 5.14.0-0ubuntu1). When idle, compiz consumes < 1% of CPU time and when moving windows and doing other things related to windows management, it consumes about 5%.

Daniel said in comment #197 that "performance bugs are almost always too vague and subjective" and I agree. My performance problem (which this bug report represents) is now solved. I'll mark this bug as fixed, and ask that other people that face similar performance problems that open another bugs reports with their specific hardware info and steps to reproduce.

Thank you for your understanding.

Changed in compiz:
status: Confirmed → Fix Released
Changed in compiz (Ubuntu):
status: Confirmed → Fix Released
Changed in compiz-core:
status: Confirmed → Fix Released
Changed in unity:
status: Confirmed → Fix Released
Changed in unity (Ubuntu):
status: Confirmed → Fix Released

Probably the bugs marked as duplicates of this one should be unmarked as duplicated and set to incomplete, waiting for feedback from the original reporters to know if the problems still happening.

What graphics card and associated driver are you using? I am on a Radeon 6950 with Catalyst 12.3 and am still having compiz utilize 2-3% CPU on idle and 50-100% while moving windows. I will try upgrading my graphics driver to see if there is any improvement.

@Jesse Johnson: I don't have the exact graphic card model, but it was a Intel card (Asus Eee PC 1001HA netbook).

odror (ozdror) wrote :

The problem is not solved. I have the same issue with the Radeon 6850.

Ubuntu Kernel 3.2.0-30-generic and unity 5.14.0

On 09/11/2012 09:07 AM, Jesse Johnson wrote:
> What graphics card and associated driver are you using? I am on a
> Radeon 6950 with Catalyst 12.3 and am still having compiz utilize 2-3%
> CPU on idle and 50-100% while moving windows. I will try upgrading my
> graphics driver to see if there is any improvement.
>

Comments #13, 34, 139, 180, 194, 202 and 204 are about performance issues with Radeon graphic cards, which *are not* the same problem of this bug report (which was originally noticed on a Intel graphic card). Please, open another bug report for the Radeon problem (if there is no report about it yet).

Karl Frisk (karl-frisk) wrote :

OK, so this bug is being closed down. Now, which is the bug to subscribe to for staying up to date with efforts to fix persistent performance issues?

Because the problem still exists in 12.10 Quantal beta 1. Moving around a window makes compiz use 25% and xorg 15% of cpu (Ivy Bridge i7, Intel Graphics HD 4000).

Daniel van Vugt (vanvugt) wrote :

No more comments please.

If you still have any problems, please log a bug of your own using this command:
    ubuntu-bug compiz

See comment #12. This bug is not hardware specific. I have the same problem on my Intel and NVIDIA cards. Should I post a bug for each card, replicate this bug but with the stipulation 'cross-hardware problem', or should we continue this bug?

Jesús (jbarcons) wrote :

The problem still exists in 12.10. Moving a window makes Xorg use 80% and Compiz 20% of CPU.

Anton Statutov (astatutov) wrote :

Jesús, try to remove fglrx driver if it is installed . This have helped me.

Daniel van Vugt (vanvugt) wrote :

No more comments please.

If you still have any problems, please log a bug of your own using this command:
    ubuntu-bug compiz

This bug is Fix Released as per comment #200.

jmalter (joerg4711) wrote :

This also effects me on my laptop Lenovo L412 with Intel Core i5 with Intel HD Graphics running on 12.10.
Top shows between 80% and 140% cpu and a load index between 1,2 and 1,4 in idle phase

GMPH (gmphtravel) on 2013-02-06
Changed in unity (Ubuntu):
assignee: nobody → GMPH (gmphtravel)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.