总CPU使用率-多核系统 [英] Total CPU usage - multicore system

查看:82
本文介绍了总CPU使用率-多核系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用xen,并且使用 xen top ,我获得了CPU总使用率的百分比:

I am using xen and with xen top I get the total CPU usage in percentage:

      NAME  STATE   CPU(sec) CPU(%)     MEM(k) MEM(%)  MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS   VBD_OO   VBD_RD   VBD_WR  VBD_RSECT  VBD_WSECT SSID

      VM1 -----r      25724  299.4    3025244   12.0   20975616      83.4    12    1 14970253 27308358    1        3   146585    92257   10835706    9976308    0

从上面可以看到,我看到CPU使用率为299%,但是如何从VM中获得CPU的使用总量呢? Top 没有显示总使用量.

As you can see from above I see the CPU usage is 299 %, but how I can get the total CPU usage from a VM ? Top doesn't show me the total usage.

推荐答案

我们通常看到每个内核100%的CPU.我想至少有3个内核/CPU.

We usually see 100% cpu per core. I guess there are at least 3 cores/cpus.

尝试此操作以计算内核数:

try this to count cores:

grep processor /proc/cpuinfo | wc -l

299%的总CPU使用率.

299% is the total cpu usage.

sar mpstat 通常用于显示系统的CPU使用情况.检查是否安装了 systat 软件包,并使用以下命令显示CPU的总使用量:

sar and mpstat are often used to display cpu usage of a system. Check that systat package is installed and display total cpu usage with:

$ mpstat 1 1
Linux 2.6.32-5-amd64 (debian)   05/01/2016      _x86_64_        (8 CPU)

07:48:51 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
07:48:52 PM  all    0.12    0.00    0.50    0.00    0.00    0.00    0.00    0.00   99.38
Average:     all    0.12    0.00    0.50    0.00    0.00    0.00    0.00    0.00   99.38

如果您同意CPU利用率为(100-%IDLE):

If you agree that CPU utilisation is (100 - %IDLE):

$ mpstat 1 1 | awk '/^Average/ {print 100-$NF,"%"}'
0.52 %

这篇关于总CPU使用率-多核系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆