I started using Linux OS a while ago so, I am a beginner. I wanted to collect total CPU for a given process into a file with a given interval. For that reason I am using sar
utility.
cpx@cpx-VirtualBox:~$ sar -u 1 4
Linux 4.4.0-142-generic (cpx-VirtualBox) 07/15/2019 _x86_64_ (1 CPU)
10:28:25 PM CPU %user %nice %system %iowait %steal %idle
10:28:26 PM all 7.22 0.00 2.06 0.00 0.00 90.72
10:28:27 PM all 10.10 0.00 3.03 0.00 0.00 86.87
10:28:28 PM all 7.14 0.00 2.04 0.00 0.00 90.82
10:28:29 PM all 7.00 0.00 2.00 0.00 0.00 91.00
In Windows, task manager shows overall CPU usage with user and kernel usage in the graph. So, I am unaware of other parameters and in Linux, it seems there's no easy way to see the total CPU.
So, What is the Total CPU here? Should I just do: 100 - idle% value
to get the total CPU Usage? Or, is it just %user + %system i.e. user time + kernel time?