My Ubuntu 18.04 randomly freezes for a few seconds. I can move the mouse cursor (sometimes), but otherwise the OS is unresponsive and I can't switch to any other application.
When it resumes, I can go to the System Monitor and see a spike in CPU usage a few seconds ago (only to 70% though), but that doesn't tell me WHAT used the CPU then.
How can you find out what processed chewed up the CPU very recently? (I don't think this is due to disk I/O).
In the meantime I've determined that the culprit is WebStorm, a Java-based IDE, by isolating suspected apps. While using VS Code, there were no freezes.
Below is some additional diagnostic info asked for in the comments.
$ free -h total used free shared buff/cache available Mem: 15G 8.6G 2.3G 2.0G 4.5G 4.4G Swap: 15G 487M 15G $ sysctl vm.swappiness vm.swappiness = 10
When WebStorm freezes, the load in System Monitor does show a spike, but nowhere near 100%.