I understand the various types of cpu usage reported by the top
command (6.5%us
, 17.2%sy
, 0.0%ni
, etc...), but why does the total %CPU for each process not add up to any of the Cpu(s)
values? For example, below the java process is consuming 77.5% CPU, yet Cpu(s)
says 76.0% is still idle. Why is this? This is on a single core system.
top - 05:53:27 up 32 min, 2 users, load average: 0.16, 0.29, 0.34
Tasks: 71 total, 1 running, 70 sleeping, 0 stopped, 0 zombie
Cpu(s): 6.5%us, 17.2%sy, 0.0%ni, 76.0%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 1758616k total, 643432k used, 1115184k free, 12224k buffers
Swap: 917500k total, 0k used, 917500k free, 304608k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1307 tomcat 20 0 683m 287m 9528 S 77.5 16.8 10:54.99 java
1571 ec2-user 20 0 2592 1096 872 R 1.0 0.1 0:08.61 top
1 root 20 0 2892 1364 1168 S 0.0 0.1 0:00.28 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
Edit: Turns out this is a dual core system. Here is updated output after pressing 1 while the top
command is up:
top - 06:10:21 up 49 min, 2 users, load average: 0.28, 0.37, 0.34
Tasks: 71 total, 1 running, 70 sleeping, 0 stopped, 0 zombie
Cpu0 : 9.9%us, 19.7%sy, 0.0%ni, 69.0%id, 0.0%wa, 0.0%hi, 1.4%si, 0.0%st
Cpu1 : 5.0%us, 10.0%sy, 0.0%ni, 85.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1758616k total, 677548k used, 1081068k free, 13296k buffers
Swap: 917500k total, 0k used, 917500k free, 305732k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1307 tomcat 20 0 683m 318m 9528 S 68.0 18.6 17:23.53 java
1 root 20 0 2892 1364 1168 S 0.0 0.1 0:00.28 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.91 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0