0

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?

James Z
  • 12,209
  • 10
  • 24
  • 44
sdgd
  • 723
  • 1
  • 17
  • 38
  • A fully-occupied single CPU thread is the reference point in `top` (100%). – ypnos Jul 11 '18 at 11:37
  • so will that mean, if I have taken few samples during my observation for that process ID (3%, 60%, 9%, 22%) and even if the number of cores are 8, i can still give those as my CPU values for that PID during that duration and say that avg CPU is 23.5% ? – sdgd Jul 11 '18 at 11:42
  • The average utilization of one CPU thread (without SMT/hyper-threading that is one CPU core) would be 23.5%, yes. – ypnos Jul 11 '18 at 11:45
  • thank you. so what does it mean when the CPU values shoots up to 150% or 170% sometimes, what can be the inference from that as we check against 100% usually ? – sdgd Jul 11 '18 at 11:51
  • 1
    This doesn't seem to be a programming question, so it should probably be asked in [superuser](https://superuser.com/) – James Z Jul 11 '18 at 13:26
  • When in `top`, just press the `1` button... – wildplasser Jul 11 '18 at 13:34
  • @JamesZ I think it better belongs in Unix & Linux –  Jul 11 '18 at 13:36
  • Sure, i'll post this question in SuperUser. Thanks. – sdgd Jul 11 '18 at 14:29
  • @wildplasser Yes, could you please tell me how should i it when the CPU shows values higher than 100? – sdgd Jul 11 '18 at 14:34

0 Answers0