On 07/06/2014 11:00 AM, 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. virsh is just a thin wrapper around the libvirt API, but has some severe overheads due to shell scripting being expensive on spawning so many processes and having to reconnect on every new virsh invocation. Batch mode helps some, but I don't know that you can set up batch mode to do periodic polling. If you care at all about efficiency, you'll want to write your own program rather than using virsh. If you want to see how virt-manager calculates CPU usage, use the source: https://git.fedorahosted.org/git/virt-manager.git Alas, I'm not familiar enough with python in general or with virt-manager in particular to point you to a specific file within that repository. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users