I would like to make the Ubuntu Linux 16.10 System Monitor % CPU utilization measurement basically agree with the ps
"pcpu", % CPU utilization for an individual Firefox browser process running on a Lenovo Thinkstation desktop with quad cores.
The Ubuntu Linux 16.10 System Monitor Preferences are currently set at:
Update interval in seconds: 3.00
Enable smooth refresh: Yes
Alert before ending or killing processes Yes
Divide CPU usage by CPU count : Yes
The ps output for the Firefox process is:
$ ps -eo pid,rss,c,pcpu,cputime,cmd | grep firefox
2848 726024 3 3.5 00:50:23 /usr/lib/firefox/firefox -new-window
After reading Linux : See CPU usage by a process for the last second, I learned how to view cpu usage for the last second. The top output for the Firefox process is:
$ top -b -d 1 | grep -in "firefox"
8: 2848 ratio 20 0 1980240 641516 115240 S 18.8 15.9 73:10.86 firefox
For the Firefox browser app, I get 3.5% pcpu from ps -eo pid,rss,c,pcpu,cputime,cmd
while for the same Firefox browser app, the GUI Application Ubuntu System Monitor shows 5% CPU utilization. In addition, I get 15.9% CPU usage from top -b -d 1 | grep -in "firefox". When that is divided by 4 for the 4 cores used by our CPU, I get 4.0% for top's output.
How can I get the ps
or top outputs and System Monitor values to agree? Should I enable the Divide CPU usage by CPU count checkbox?
ps
reports CPU% as a percentage of a single core and the GUI tool reports it as a percentage of ll available cores. – terdon♦ May 13 '16 at 15:14