How to find the cause for high CPU usage of gnome-shell?

Solution 1:

Perhaps try using auditd, which would roughly be something like:

sudo yum install auditd  # sudo apt install auditd on Debian
sudo auditctl -a exit,always -S all -F pid=1234 & sleep 15
sudo auditctl -d exit,always -S all -F pid=1234
less /var/log/audit/audit.log

This will install and start auditd, set a policy to capture system call info for your PID (1234 in the example), wait for a short while to capture a decent amount of info, then remove the audit policy. Take a good look over the auditd.log for your gnome-terminal PID, you may get a better idea of what it's busy doing.

Another quick tool for spotting what a process is spending it's time doing is just strace, wait a short time, then hit Ctrl + C:

$ sudo strace -c -p 1234
strace: Process 1234 attached
^Cstrace: Process 1234 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 56.98    0.003496         388         9           clone
 17.19    0.001055           8       135           rt_sigprocmask
  6.19    0.000380          21        18         9 wait4
  4.58    0.000281          16        18           close
  3.80    0.000233          26         9           read
  3.47    0.000213          24         9           stat
  3.37    0.000207          23         9         9 rt_sigsuspend
  3.08    0.000189          21         9           pipe
  1.34    0.000082           9         9         9 rt_sigreturn
------ ----------- ----------- --------- --------- ----------------
100.00    0.006136                   225        27 total

Then if you want to learn more, check the appropriate man page for the system call you're looking at:

$ man -s2 clone

Solution 2:

There could be several causes of it:

  1. clock with seconds
gsettings set org.gnome.desktop.interface clock-show-seconds false
  1. indicator-multiload (CPU etc. usage monitor in bar)

Process could be named in menu: System Load Indicator

Just stop process (or before stopping it, disable autostart option. Setting longer time for probing also helps, but for example 10 sec. makes whole app useless.

  1. anything with "real time" monitoring, disk, cpu, network