[Libvir] How to get the memory used by a guest domin

Daniel P. Berrange berrange at redhat.com
Wed Apr 30 12:18:58 UTC 2008

On Wed, Apr 30, 2008 at 05:45:55PM +0530, Pranay Prasoon wrote:
> Hi,
> It appears to be no API available to provide the memory used by a guest
> domin.
> I looked at the availble libvirt api called "virNodeGetCellsFreeMemory"
> using which it is possible to get the free mem. But looking further I found
> that this is free memory of the "whole box" rather than based upon the guest
> domain.
> How can I get the memory used by a guest domin.


It fills in a virDomainInfo  struct with 

    unsigned long maxMem;       /* the maximum memory in KBytes allowed */
    unsigned long memory;       /* the memory in KBytes used by the domain */

|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list