How to obtain virtual/physical CPU information in Oracle VM (XEN)

This post explains how to obtain virtual or physical CPU usage of an Oracle VM Server, including actual CPU usage and running time of guest domains. Guest-specific (Dom-U) CPU usage can be obtained by running commands on the guest itself, for example; top, ps, and sar.

If, however, you wish to obtain specific CPU usage, including that of the Oracle VM Server management domain/hypervisor (Dom-0), the following xen-tools utilities are available to run on the Oracle VM Server:

In the example above, domains Domain-0, 4474_EL5U2 and 4511_EL564 each utilize two virtual CPUs, whereas all others only utilize one virtual CPU. Domain Domain-0 utilizes a total CPU time of 87787 seconds; 57,819 seconds on VCPU0 and 29,968 seconds on VCPU1.

“CPU percentage which the guest OS consumes currently. Note1: This is calculated as CPU(%) = Actuall Assigned CPU# * Actual CPU Usage on the Guest OS(0-100%).Thus this could be up to 300% when 3 CPUs are assigned to the Guest OS. “”Actuall Assigned CPU#”” is not the Virtual CPU Number assigned to the Guest OS, But Actual CPU Number assigned to the Guest OS, since it should be up to 200% when physical CPU cores are 2 even if VCPUs assigned to the Guest OS are 3 or more. Note2: this is always 0.0% at the 1st xentop output, since this is calculated by dividing the interval of the updates. Thus “”-i”” option needs to be set as 2 or more to get correct CPU(%). Note3: This just shows the CPU usage on Host OS for the Guest OSs, therefore this could be different from the CPU usage (ex. which “”top”” shows) on the Guest OSs.”

MEM(k)

Memory size in Kbyte which the guest OS occupies on host OS memory. For Domain0, this is equal value of dom0_mem= specified in /etc/grub.conf of Host OS, and also equal value of “memory =” in vm.cfg for Guest OS. ex. dom0_mem=1024M shows 1048576(kB) for MEM(k) for the Host OS.

MEM(%)

Memory size in percentage which the guest OS occupies on host OS memory

MAXMEM(k)

Max memory size in Kbyte which the guest OS could occupies on host OS memory

The above example output displays information about physical CPU 0 i.e. how CPU=0 is used by various domains and how long it has been used within the last 1 and 10 seconds. The first column reports the Domain ID – 0 refers to Dom-0.

Three lines are printed for each domain:

1st row: Gotten = amount of the CPU time/percentage which the CPU is running on the domain.

2nd row: Blocked = amount of sleeping time/percentage.

3rd row: Waited = amount of the CPU time/percentage which the domain is in wait state.

Press the ‘p’ or ‘n’ key to display information for the previous/next physical CPU.

Xenmon.py usage:

usage: xenmon.py [options]
options:
-h, --help show this help message and exit
-l, --live show the ncurses live monitoring frontend (default)
-n, --notlive write to file instead of live monitoring
-p PREFIX, --prefix=PREFIX
prefix to use for output files
-t DURATION, --time=DURATION
stop logging to file after this much time has elapsed
(in seconds). set to 0 to keep logging indefinitely
-i INTERVAL, --interval=INTERVAL
interval for logging (in ms)
--ms_per_sample=MSPERSAMPLE
determines how many ms worth of data goes in a sample
--cpu=CPU specifies which cpu to display data for
--allocated Display allocated time for each domain
--noallocated Don't display allocated time for each domain
--blocked Display blocked time for each domain
--noblocked Don't display blocked time for each domain
--waited Display waiting time for each domain
--nowaited Don't display waiting time for each domain
--excount Display execution count for each domain
--noexcount Don't display execution count for each domain
--iocount Display I/O count for each domain
--noiocount Don't display I/O count for each domain