统计CPU的占用率

关于 top 命令

[root@server39rtmp proc]# top
top - 16:03:55 up 47 days, 23:12,  2 users,  load average: 0.04, 0.37, 0.55
Tasks: 568 total,   1 running, 567 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.0 us,  0.7 sy,  0.0 ni, 98.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 32660284 total,  5900228 free,  7857008 used, 18903048 buff/cache
KiB Swap: 16449532 total, 16256252 free,   193280 used. 23769584 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 6784 git       20   0 1932564 800032  16712 S   7.0  2.4 112:29.15 bundle
 9912 polkitd   20   0  620244  15104   4344 S   7.0  0.0   4894:26 polkitd
 6624 gitlab-+  20   0   80168   9968   1936 S   2.6  0.0  38:29.42 redis-server
 9919 dbus      20   0   70292   3940   1664 S   2.6  0.0   1811:47 dbus-daemon
 9913 root      20   0  396816   5708   2800 S   1.7  0.0   1185:58 accounts-daemon
  • 第一行:

    top - 16:03:55 up 47 days, 23:12,  2 users,  load average: 0.04, 0.37, 0.55

    效果等同于 uptime

    [root@server39rtmp proc]# uptime
     16:05:53 up 47 days, 23:14,  2 users,  load average: 0.13, 0.32, 0.51
  • 第二行: