I have another problem. 
As in java bindings there is no way to obtain cpu stats I decided to use a python script.
It gives me, for the guest domain, cpu time, system time and user time.
Now, what does it mean cpu time? I though that it could be the overall cpu time given to this vm...but the sum doesn't add up: user_time+system_time != cpu_time.
As I would need to get a %cpu usage, like virt-manager does (so it IS possible, and it IS in python), what operation do I need to do to make this happen? 


2014-03-12 13:36 GMT+01:00 Pasquale Dir <phate867@gmail.com>:
Hello,
I need to get how much memory is used by a guest system, in order to implement some monitoring function which tells me if the system is overstressed.

I am currently using java apis and the binding which was suggested to me was
Domain.memoryStats();

This is a binding to  int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats, unsigned int nr_stats, unsigned int flags).

Problem is that it returns me just tags 0,6 and 7.
Looking at the documentation I see they are not what I am looking for...I would rather need 4 (VIR_DOMAIN_MEMORY_STAT_UNUSED) and 5 (VIR_DOMAIN_MEMORY_STAT_AVAILABLE).

Is there a way to set them?