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

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


I want to get a relatively accurate cpu usage of a domain. I have a few questions about  virDomainGetInfo:
  1. struct virDomainInfo{  
  2. unsigned char state : //the running state, one of virDomainState    
  3. unsigned long maxMem :// the maximum memory in KBytes allowed   
  4. unsigned long memory :// the memory in KBytes used by the domain   
  5. unsigned short nrVirtCpu :// the number of virtual CPUs for&! nbsp;the domain   
  6. unsigned long long cpuTime : //the CPU time used in nanoseconds   
  7. }  

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 


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