[libvirt-users] getting CPU usage through virsh command or libvirt API

Michal Privoznik mprivozn at redhat.com
Mon Jul 7 12:09:17 UTC 2014


On 06.07.2014 19:00, Restituto Marcus Arevalo wrote:
> Hi,
>
>
>      Is it possible to get the CPU usage of a guest through a virsh
> command? I have tried almost all the commands (vcpuinfo, cpu-stats,
> etc.) that gets the details of a guest cpu, but it only returns the cpu
> time. Is there any command that returns the cpu usage (just like the
> graph that virt-manager displays) of a guest? Or do I have to create a
> program using libvirt API? Thanks in advance.

As I replied in your previous e-mail, libvirt doesn't expose this kind 
of information. It's the best if client computes the value it needs from 
the information libvirt provides.

Having said that, virt-top[1] may serve as good example, although it's 
written in OCaml, not C.

Michal

1: http://people.redhat.com/~rjones/virt-top/




More information about the libvirt-users mailing list