10

I don't understand why the sum of % in the cpu column in top doesn't match the total CPU % row:

enter image description here

Text version with slightly different values:

ubuntu@server:~$ top
top - 23:20:21 up  5:18,  3 users,  load average: 10.28, 10.36, 10.20
Tasks: 299 total,  11 running, 288 sleeping,   0 stopped,   0 zombie
%Cpu(s): 41.7 us,  0.0 sy,  0.0 ni, 58.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  99007376 total, 83451488 used, 15555892 free,    36212 buffers
KiB Swap:        0 total,        0 used,        0 free.  5139148 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 5914 ubuntu    20   0   25784   3396   1452 S   1.3  0.0   0:05.33 htop
 1473 root      20   0  373896   1444   1012 S   1.0  0.0   0:03.72 automount
  263 root      20   0       0      0      0 S   0.3  0.0   1:37.69 kworker/7:1
 6000 ubuntu    20   0   23812   1864   1176 R   0.3  0.0   0:00.41 top
    1 root      20   0   33500   2908   1496 S   0.0  0.0   0:03.87 init
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.36 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.06 ksoftirqd/0
    4 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    6 root      20   0       0      0      0 S   0.0  0.0   0:03.48 kworker/u48:0
    7 root      20   0       0      0      0 S   0.0  0.0   1:49.74 rcu_sched
    8 root      20   0       0      0      0 S   0.0  0.0   0:01.74 rcuos/0
    9 root      20   0       0      0      0 S   0.0  0.0   0:02.69 rcuos/1
   10 root      20   0       0      0      0 S   0.0  0.0   0:01.87 rcuos/2
   11 root      20   0       0      0      0 S   0.0  0.0   0:00.90 rcuos/3
   12 root      20   0       0      0      0 S   0.0  0.0   0:00.58 rcuos/4
   13 root      20   0       0      0      0 S   0.0  0.0   0:01.34 rcuos/5
   14 root      20   0       0      0      0 S   0.0  0.0   0:00.79 rcuos/6
   15 root      20   0       0      0      0 S   0.0  0.0   0:00.92 rcuos/7
   16 root      20   0       0      0      0 S   0.0  0.0   0:00.77 rcuos/8
   17 root      20   0       0      0      0 S   0.0  0.0   0:01.51 rcuos/9

What could explain this?

htop shows the same:

enter image description here

The computer has 24 cores. More exactly, it's a virtual machine on an OpenStack cluster.

top video:

enter image description here

Franck Dernoncourt
  • 4,749
  • 15
  • 48
  • 79

1 Answers1

3

It can be that top is reading the whole usage of the physical CPUs, not of the virtual CPUs.

It is also possible, that there are some processess running, that are hidden for the ubuntu user.

Also try running ps aux.

You can type the 1 number while running top to get detailed information about the CPUs usages.

Here is the notation from man top point 2b:

us, user    : time running un-niced user processes
sy, system  : time running kernel processes
ni, nice    : time running niced user processes
id, idle    : time spent in the kernel idle handler
wa, IO-wait : time waiting for I/O completion
hi : time spent servicing hardware interrupts
si : time spent servicing software interrupts
st : time stolen from this vm by the hypervisor

CPU full load

ncomputers
  • 1,496
  • 1
  • 11
  • 23
  • Thanks, that's correct, i.e. the sum of % CPU can be larger than the total % CPU. But how can it be lower shown in the screenshots and the question? – Franck Dernoncourt Jan 31 '16 at 05:17
  • It seems that `top` is reading the load of the physical CPUs, not of the virtual. You can also press the `1` number while running `top` to get more details.... – ncomputers Jan 31 '16 at 05:32
  • @FranckDernoncourt run `ps aux` to see if there are some running processes, that you can't see with `top`.. – ncomputers Jan 31 '16 at 05:35
  • 1
    There are indeed instructions that read the physical CPUs, while others read the virtual. My fault too I never remember which is which. I could search vmstat or mpstat are the virtual ones. – Rui F Ribeiro Jan 31 '16 at 06:37