Skip to content

ps aux gives higher CPU usage than possible

This is a downstream bug in neofetch that I recently just noticed. I've isolated it down to this line.

image

cpu_usage="$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}')"

image

While ps should give higher than 100% usage for multi-threaded applications it's impossible to get more than 1600 (16 thread CPU). I've seen threads saying that it is okay since apps can be multi-threaded and therefore leading to more than 100% but I've not seen threads reporting more than (core_count x 100%) so this could be an unreported issue leading back years.

System: Arch linux on kernel Linux 5.10.7-zen1-1-zen ps from procps-ng 3.3.16