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