x11-calc
x11-calc copied to clipboard
Excessive CPU usage in Ubuntu 14.04 with GNOME 3 & Xorg
I just tried building and running the latest from GitHub in a VM running Ubuntu 14.04, and I found that it was dropping mouse events as well, and also just being unbearably sluggish overall. I noticed that while the app was running, compiz was running at over 100% CPU, and xorg was using another 40% or so. Compiz pegging a core could explain the dropped events.
Note that this version does include the -std=gnu99 option that was mentioned earlier... it also includes -no-pie in src/makefile, which I had to remove because it was not recognized, and causing compilation to fail.
Output from dpkg --get-selections attached.[ dpkg-selections.txt ](url)
The VM host is VirtualBox 6.1.29 r148218 running under the latest MacOS; the desktop is GNOME 3 with Xorg (no Wayland).
Tasks: 203 total, 2 running, 201 sleeping, 0 stopped, 0 zombie
%Cpu(s): 62.3 us, 14.9 sy, 0.0 ni, 22.6 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem: 2048144 total, 1580932 used, 467212 free, 19440 buffers
KiB Swap: 2095100 total, 7652 used, 2087448 free. 450480 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2051 thomas 20 0 1638940 276124 67544 R 116.3 13.5 2:31.84 compiz
1019 root 20 0 373216 84776 30160 S 33.2 4.1 0:56.02 Xorg
3318 thomas 20 0 22340 2944 2620 S 2.3 0.1 0:01.28 x11-calc-67
2281 thomas 20 0 1619444 201468 112084 S 0.7 9.8 0:17.05 Web Content
2348 thomas 20 0 1839656 243068 82820 S 0.7 11.9 0:15.93 WebExtensions
7 root 20 0 0 0 0 S 0.3 0.0 0:00.68 rcu_sched
144 root 0 -20 0 0 0 S 0.3 0.0 0:00.01 kworker/1:1H
1734 thomas 20 0 182964 2832 2484 S 0.3 0.1 0:01.25 VBoxClient
2558 thomas 20 0 659576 30608 22332 S 0.3 1.5 0:01.39 gnome-terminal
3331 thomas 20 0 29168 3128 2576 R 0.3 0.2 0:00.11 top
I can reproduce the problem using Ubuntu 14.04 and 20.04 running on KVM/QEMU (with 2 CPUs 4GB RAM) with the unity desktop where the CPU utilisation due to compiz and Xorg jumps to approximately 93% and 21% respectively as soon as the application is opened, even if the display isn't being updated.
Simplifying the display to reduce the number of X11 primitives that need to be redrawn each time the display is updated made no apparent difference to the CPU utilisation.
The problem seems to be specific to compiz as after switching to the MATE desktop environment on Ubuntu 20.04 Xorg only consumes about 12% of the available CPU on the same virtual machine.