[libvirt-users] The accurate CPU usage of a domain?

张章 zhang_zhang at live.com
Thu Feb 28 03:25:40 UTC 2013


Hi,all
I want to get a relatively accurate cpu usage of a domain. I have a few questions about  virDomainGetInfo:  struct virDomainInfo{  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   }  
If a domain is assigned to 4 vcpus and my machine has 6 physical cores, then the cpuTime in virDomainInfo should be the sum of cpu time of the 4 vcpus. When I want to calculate the cpu usage, which of the following is more accurate?      1/4 * cpu time /  total time  or  4/6 * cpu time / total time  or just cpu time / total time 

regardszhangzhang

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130228/d009e9b6/attachment.htm>


More information about the libvirt-users mailing list