[libvirt-users] No way to obtain guest's cpu and mem usage?

Daniel P. Berrange berrange at redhat.com
Thu Apr 12 09:11:29 UTC 2012


On Thu, Apr 12, 2012 at 10:48:05AM +0200, RaSca wrote:
> Il giorno Gio 12 Apr 2012 10:39:42 CEST, Daniel P. Berrange ha scritto:
> [...]
> > Yes, I'd suggest adding it to libvirt-php.
> > Daniel
> 
> But wait Daniel,
> as far as I see, the only info I can obtain from virDomainGetInfo are:
> 
> unsigned char	state	: the running state, one of virDomainState
> unsigned long	maxMem	: the maximum memory in KBytes allowed
> unsigned long	memory	: the memory in KBytes used by the domain
> unsigned short	nrVirtCpu	: the number of virtual CPUs for the domain
> unsigned long long	cpuTime	: the CPU time used in nanoseconds
> 
> which are *exact* the same data I can reach from the php function
> libvirt_domain_get_info. But these are NOT live stats, these does not
> contain the actual cpu and memory usage.

Err, yes they are the live stats. 'memory' shows the current memory
consumed by the VM, while 'cpuTime' shows the absolute CPU time
consumed since boot. To get % CPU time, take two readings 'n' seconds
apart and calculate the delta between them


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list