How to find memory utilization percent of kvm guest?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I currently use following approach but its failing


Find Max memory using following API

        vdgiRet = virDomainGetInfo(domPtr, infoPtr);
        memTotal = infoPtr->memory;


Find current utilization using following API
       
        rVal = virDomainMemoryStats (domPtr, memStats, VIR_DOMAIN_MEMORY_STAT_NR, 0) ;
        for (i = 0; i < rVal; i++)
        {
            if (memStats[i].tag == 7)
                memUsed = memStats[i].val;
        }

Which is the value of "VIR_DOMAIN_MEMORY_STAT_RSS    =    7"



Then I calculate util as (memUsed/memTotal)

But the value of memUsed exceeds value of memTotal by small amount resulting in memUtil to be around 101 %.

I understand that VIR_DOMAIN_MEMORY_STAT_RSS is Resident Set Size of the process running the domain.


How do I Calculate the current memory utilization using alternate way?
_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux