5

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

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.

1 Answer 1

5

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% is the total cpu usage.

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

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

$ mpstat 1 1 | awk '/^Average/ {print 100-$NF,"%"}'
0.52 %
Sign up to request clarification or add additional context in comments.

4 Comments

I want to see the CPU usage in total across all of the cores.
@user3580316 I think that 299% is the total cpu usage (I do not know xen). top and sar are often used.
thanks. But it doesn't show the summary of the total cpu usage, only for usage for each cpu core.
@Jayjargot Sorry to re-open the question, is it always correct to use as standard 100-idle (In my case I have a system monitoring written as sh script in a huge server. 2xE5-2667 v4 8core)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.