Ubuntu 20.04 slows down after usage

I have a DELL laptop with Ubuntu 20.04. It's been a while that after some usage (e.g. firefox, some video-calls, etc.) it becomes slow. There are some processes which start to take higher percentage of cpu (even if they do not take the whole cpu). In this image there's the output of htop.My processes

I don't understand why those processes keep my cpu usage high.

Any help is appreciated.

EDIT: As you can see in the image, I have 32 GB of Ram. The computer slows down depending on what I do. Also youtube videos slow down my laptop. At the beginning (one month ago) it was much faster. I also tried to re-install Ubuntu but it didn't get better.

EDIT2: Some more command outputs from the command linetop output and Other command outputs

EDIT3:

francesco@dell-latitude-inria:~/Desktop$ sudo lshw -C video
  *-display                 
       description: VGA compatible controller
       product: UHD Graphics 620 (Whiskey Lake)
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 02
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:165 memory:cb000000-cbffffff memory:80000000-8fffffff ioport:3000(size=64) memory:c0000-dffff

then

francesco@dell-latitude-inria:~/Desktop$ sudo lshw -C memory
  *-firmware                
       description: BIOS
       vendor: Dell Inc.
       physical id: 0
       version: 1.12.0
       date: 02/24/2021
       size: 64KiB
       capacity: 32MiB
       capabilities: pci pnp upgrade shadowing cdboot bootselect edd int13floppynec int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb smartbattery biosbootspecification netboot uefi
  *-memory
       description: System Memory
       physical id: 20
       slot: System board or motherboard
       size: 32GiB
     *-bank:0
          description: SODIMM DDR4 Synchronous 2667 MHz (0,4 ns)
          product: HMA82GS6JJR8N-VK
          vendor: Hynix Semiconductor (Hyundai Electronics)
          physical id: 0
          serial: 2FA26C44
          slot: DIMM A
          size: 16GiB
          width: 64 bits
          clock: 2667MHz (0.4ns)
     *-bank:1
          description: SODIMM DDR4 Synchronous 2667 MHz (0,4 ns)
          product: HMA82GS6JJR8N-VK
          vendor: Hynix Semiconductor (Hyundai Electronics)
          physical id: 1
          serial: 2FA26909
          slot: DIMM B
          size: 16GiB
          width: 64 bits
          clock: 2667MHz (0.4ns)
  *-cache:0
       description: L1 cache
       physical id: 29
       slot: L1 Cache
       size: 256KiB
       capacity: 256KiB
       capabilities: synchronous internal write-back unified
       configuration: level=1
  *-cache:1
       description: L2 cache
       physical id: 2a
       slot: L2 Cache
       size: 1MiB
       capacity: 1MiB
       capabilities: synchronous internal write-back unified
       configuration: level=2
  *-cache:2
       description: L3 cache
       physical id: 2b
       slot: L3 Cache
       size: 8MiB
       capacity: 8MiB
       capabilities: synchronous internal write-back unified
       configuration: level=3
  *-memory UNCLAIMED
       description: RAM memory
       product: Cannon Point-LP Shared SRAM
       vendor: Intel Corporation
       physical id: 14.2
       bus info: pci@0000:00:14.2
       version: 30
       width: 64 bits
       clock: 33MHz (30.3ns)
       capabilities: pm cap_list
       configuration: latency=0
       resources: memory:cc320000-cc321fff memory:cc32b000-cc32bfff

then

francesco@dell-latitude-inria:~/Desktop$ ls -al ~/.local/share/gnome-shell/extensions
total 12
drwxrwxr-x 3 francesco francesco 4096 mai   19 11:47 .
drwx------ 3 francesco francesco 4096 mai   28 13:39 ..
drwxrwxr-x 4 francesco francesco 4096 mai   19 11:47 [email protected]

then

francesco@dell-latitude-inria:~/Desktop$ ls -al /usr/share/gnome-shell/extensions
total 20
drwxr-xr-x 5 root root 4096 avril 23  2020 .
drwxr-xr-x 7 root root 4096 mai   19 09:16 ..
drwxr-xr-x 2 root root 4096 mai   19 09:17 desktop-icons@csoriano
drwxr-xr-x 3 root root 4096 mai   19 09:17 [email protected]
drwxr-xr-x 3 root root 4096 mai   19 09:17 [email protected]

then

francesco@dell-latitude-inria:~/Desktop$ snap list
Name                 Version                     Rev    Tracking         Publisher         Notes
canonical-livepatch  9.6.2                       99     latest/stable    canonical✓        -
core                 16-2.50                     11081  latest/stable    canonical✓        core
core18               20210507                    2066   latest/stable    canonical✓        base
core20               20210429                    1026   latest/stable    canonical✓        base
gimp                 2.10.24                     372    latest/stable    snapcrafters      -
gnome-3-28-1804      3.28.0-19-g98f9e67.98f9e67  145    latest/stable    canonical✓        -
gnome-3-34-1804      0+git.3556cb3               66     latest/stable/…  canonical✓        -
gtk-common-themes    0.1-52-gb92ac40             1515   latest/stable/…  canonical✓        -
snap-store           3.38.0-59-g494f078          518    latest/stable/…  canonical✓        -
snapd                2.50                        11841  latest/stable    canonical✓        snapd
telegram-desktop     2.7.4                       2637   latest/stable    telegram.desktop  -

EDIT 4:

When trying to open an application (firefox, or visual studio code) what happens is that they take a LOT of CPU at the beginning and then not anymore, but still the system is slow

top - 17:30:58 up 27 min,  1 user,  load average: 1,82, 3,20, 3,41
Tasks: 296 total,   6 running, 290 sleeping,   0 stopped,   0 zombie
%Cpu(s): 54,5 us,  8,0 sy,  0,0 ni, 37,3 id,  0,2 wa,  0,0 hi,  0,1 si,  0,0 st
MiB Mem :  31930,6 total,  26496,8 free,   2301,1 used,   3132,8 buff/cache
MiB Swap:   2048,0 total,   2048,0 free,      0,0 used.  28361,5 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                   
  10409 frances+  20   0 4475420 120928  61060 R 167,8   0,4   0:09.46 code                                                      
  10341 frances+  20   0   50,5g 255440 111076 R 159,3   0,8   0:15.14 code                                                      
  10382 frances+  20   0 4508992 139532  66160 R  57,0   0,4   0:03.10 code                                                      
  10394 frances+  20   0   36,4g 169484  93784 S  30,3   0,5   0:07.08 code                                                      
   1842 frances+  20   0 5270364 291192 105076 S  16,9   0,9   4:10.51 gnome-shell                                               
  10309 frances+  20   0  543340 125196  89264 R  14,3   0,4   0:01.81 code                                                      
  10279 frances+  20   0 4775044 144700 106712 S  14,0   0,4   0:01.71 code                                                      
   1683 frances+  20   0  869272  78712  43672 R  10,7   0,2   2:25.79 Xorg                                                      
   9860 frances+  20   0  968660  54596  41608 S   5,9   0,2   0:02.94 gnome-terminal-                                           
  10450 frances+  20   0   10896   5096   3460 S   5,9   0,0   0:00.18 bash                                                      
  10430 frances+  20   0 4475432  76348  60928 S   4,6   0,2   0:00.83 code                                                      
    768 root      20   0  273900   9404   8544 S   3,3   0,0   0:38.77 thermald                                                  
  10328 frances+  20   0  256532  77572  68320 S   3,3   0,2   0:00.16 code                                                      
   9300 frances+  20   0 3994300 430172 221396 S   1,6   1,3   2:10.01 firefox                                                   
   9877 frances+  20   0   12132   4200   3260 R   1,6   0,0   0:01.59 top                                                       
   9192 root      20   0       0      0      0 I   1,3   0,0   0:01.29 kworker/5:3-events                                        
   9598 frances+  20   0 2882896 254248 156000 S   1,3   0,8   1:19.61 Web Content                                               
   9510 frances+  20   0 2496384 140660  96472 S   0,7   0,4   0:13.56 WebExtensions                                

Solution 1:

partial answer...

In reviewing /var/log/syslog around the suspected time of slowdown, I come away with these processes that need investigation...

  • remarkable - lots of network errors
  • livepatch - performing updates
  • telegram - real time priority
  • gnome-shell - window manager errors (do you have any themes installed?)

Update #1:

Reviewed 2nd syslog...

  • lots of wireless disconnects/reconnects
  • gnome-shell crash

Update #2:

  • the code application is using a lot of CPU%