Linux

頂級命令 - 總體 cpu 使用率小於程序的 cpu 使用率

  • October 26, 2017
top - 14:51:31 up 11:24,  5 users,  load average: 0.79, 0.95, 0.97
Tasks: 173 total,   2 running, 171 sleeping,   0 stopped,   0 zombie
%Cpu(s):  9.1 us,  4.5 sy,  0.0 ni, 85.5 id,  0.0 wa,  0.0 hi,  1.0 si,  0.0 st
KiB Mem : 32601524 total, 24374660 free,  2048104 used,  6178760 buff/cache
KiB Swap:  8191996 total,  8191996 free,        0 used. 28478564 avail Mem

 PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
27018 mysql     20   0 7548496 1.682g  12528 S  91.7  5.4  56:12.75 /usr/sbin/mysqld

Mysql user is using 91.7% but %cpu is 9.1 這是什麼意思?

此伺服器僅執行 mysql

正如**@c4f4t0r** alreydy 提到的,這意味著您的機器上有多個 CPU 核心。您可以按下1並查看每個 CPU 的負載。它應該看起來像:

top - 11:14:48 up 100 days, 13:14,  1 user,  load average: 1.31, 1.52, 1.60
Tasks: 302 total,   1 running, 301 sleeping,   0 stopped,   0 zombie
Cpu0  : 20.5%us,  6.9%sy,  0.0%ni, 43.2%id, 28.1%wa,  0.0%hi,  0.0%si,  1.3%st
Cpu1  : 12.7%us,  0.7%sy,  0.0%ni, 85.3%id,  0.0%wa,  0.0%hi,  0.0%si,  1.3%st
Cpu2  :  4.6%us,  1.3%sy,  0.0%ni, 92.1%id,  0.0%wa,  0.0%hi,  0.0%si,  2.0%st
Cpu3  : 37.6%us,  5.0%sy,  0.0%ni, 55.4%id,  0.0%wa,  0.0%hi,  0.7%si,  1.3%st
Cpu4  : 42.0%us,  1.0%sy,  0.0%ni, 53.4%id,  2.0%wa,  0.0%hi,  0.0%si,  1.6%st
Cpu5  :  8.9%us,  0.7%sy,  0.0%ni, 89.1%id,  0.3%wa,  0.0%hi,  0.0%si,  1.0%st
Mem:  10127380k total,  9939356k used,   188024k free,   165304k buffers
Swap:     1020k total,     1020k used,        0k free,  3213328k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
9364 mysql     20   0 9858m 5.6g 5068 S 103.6 57.5  40717:04 mysqld

引用自:https://serverfault.com/questions/880242