I am currently using the TOP
command to fetch the CPU
and Memory
of a process. My query here is on understanding the value it displays.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6742 aaaa 20 0 843596 1.0g 238841 S 4.0 1.7 0:49.66 java
14355 aaaa 20 0 658704 749560 234112 S 3.3 1.2 15:45.75 java
2779 aaaa 20 0 688868 846620 160844 S 3.0 1.4 54:30.61 java
2337 aaaa 20 0 701200 1.0g 231923 S 2.3 1.7 13:18.34 java
Let's say, I'm monitoring the CPU of a process ID 6742, it sometimes show 4%, sometimes 8%, 6% and sometimes it shoots up to 200% and comes back. When i check the number of cores the system has, it says 8.
nproc -> 8
So should I calculate the CPU which is shown in the TOP command or should i calculate it based on the number of cores, like since it has 8 cores, so out of 800%, the CPU is 200% for that process ID.
How should we calculate this scenario?