<div dir="ltr">I have another problem. <div>As in java bindings there is no way to obtain cpu stats I decided to use a python script.</div><div>It gives me, for the guest domain, cpu time, system time and user time.</div><div>
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.</div><div>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? </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-12 13:36 GMT+01:00 Pasquale Dir <span dir="ltr"><<a href="mailto:phate867@gmail.com" target="_blank">phate867@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello,<div>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.</div><div><br></div><div>I am currently using java apis and the binding which was suggested to me was</div>

<div>Domain.memoryStats();</div><div><br></div><div>This is a binding to  <span style="font-weight:bold;white-space:nowrap;color:rgb(72,61,139)">int</span><span style="background-color:rgb(238,238,238)">   virDomainMemoryStats            (</span><span style="font-weight:bold;white-space:nowrap;color:rgb(72,61,139)"><a href="http://libvirt.org/html/libvirt-libvirt.html#virDomainPtr" style="color:rgb(86,104,102);text-decoration:none" target="_blank">virDomainPtr</a></span><span style="background-color:rgb(238,238,238)"> dom, </span><span style="font-weight:bold;white-space:nowrap;color:rgb(72,61,139)"><a href="http://libvirt.org/html/libvirt-libvirt.html#virDomainMemoryStatPtr" style="color:rgb(86,104,102);text-decoration:none" target="_blank">virDomainMemoryStatPtr</a></span><span style="background-color:rgb(238,238,238)"> stats,</span><span style="background-color:rgb(238,238,238)"> </span><span style="font-weight:bold;white-space:nowrap;color:rgb(72,61,139)">unsigned int</span><span style="background-color:rgb(238,238,238)"> nr_stats,</span><span style="background-color:rgb(238,238,238)"> </span><span style="font-weight:bold;white-space:nowrap;color:rgb(72,61,139)">unsigned int</span><span style="background-color:rgb(238,238,238)"> flags).</span></div>

<div><span style="background-color:rgb(238,238,238)"><br></span></div><div><font color="#000000"><span style="background-color:rgb(238,238,238)">Problem is that it returns me just tags 0,6 and 7.</span></font></div>
<div><font color="#000000"><span style="background-color:rgb(238,238,238)">Looking at the documentation I see they are not what I am looking for...I would rather need 4 (</span></font>VIR_DOMAIN_MEMORY_STAT_UNUSED) and 5 (VIR_DOMAIN_MEMORY_STAT_AVAILABLE).</div>

<div><br></div><div>Is there a way to set them?</div></div>
</blockquote></div><br></div>