CPU usage goes to 100% when I lock the screen

Whenever I lock the screen, after a certain amount of time, the CPU and the CPU fan go to their limits, and they return back to normal the moment I unlock the screen again (as shown by psensor).

How can I find out what process is responsible for this?

I've tried with "top -S", and the result is this...

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND    
 2114 me       20   0  326m 104m  40m R   16  2.6  66:50.03 compiz     
 1234 root     20   0  396m 152m  98m R    6  3.8  20:23.88 Xorg       
 2204 me       20   0  160m  38m  30m S    4  1.0   0:33.35 yakuake    
 2446 me       20   0  206m  18m  12m S    4  0.5   6:32.18 psensor    
 2280 me       20   0  220m  18m  10m S    2  0.5   5:01.60 unity-panel
 9138 me       20   0  154m  27m  15m S    2  0.7   0:03.63 plugin-cont
 2282 me       20   0 65800 5272 3316 S    1  0.1   4:36.90 hud-service
 2143 me       20   0  140m  11m 8352 S    1  0.3   2:50.16 indicator-m
 9095 me       20   0  720m 253m  36m S    1  6.4   0:26.34 firefox    
 2076 me       20   0  7168 3484  828 S    1  0.1   1:46.53 dbus-daemon
 2307 me       20   0 55000 5132 3632 S    1  0.1   2:01.55 indicator-a
 2557 me       20   0 86328 6028 4576 S    0  0.1   1:44.71 conky      
 6290 me       20   0  2836 1296  964 R    0  0.0   0:29.64 top        
 6291 me       20   0  2836 1188  884 S    0  0.0   0:29.49 top        
   1 root      20   0  3644 1984 1284 S    0  0.0  60:57.76 init  

Specs:

  • Fresh installation of Ubuntu 12.04
  • Intel Core i5
  • 4 GB RAM

Solution 1:

Maybe [fglrx] compiz uses 100% CPU when screen turns off (..) is your problem as well. Then here is what you can try to do:

WORKAROUND:

  1. Open Catalyst Control Center.
  2. Go to 3D > More Settings.
  3. Set "Wait for vertical refresh" to "On, unless application specifies". And if that doesn't work, then also do:
  4. Run "ccsm"
  5. In Workarounds, enable "Force full screen redraw (buffer swap) on repaint".

Please, also mark the bug as "This bug affects me" if it should be the case.

Solution 2:

To find out which processes use the CPU while the screen is locked, use

top -b -i > watch.txt

and lock the screen. Wait a while, then look at the file. I found out that compiz and emacs are having a lot of fun while I am away.