[virt-tools-list] CPU graphs

Alan Bell alanbell at ubuntu.com
Fri May 27 08:18:48 UTC 2011


Hi all

I found that the CPU activity sparkgraphs were not working well for me 
as they were showing the activity as a percentage of the overall host 
CPU power, so on a 12 core machine a single processor VM that was 
sitting spinning maxing out it's CPU was only showing a graph 1/12 full.
the relevant code is in domain.py, line 1509 or thereabouts

             avg = ((newStats["cpuTimeAbs"] - startCpuTime) / nSamples)
             percent = ((newStats["cpuTimeAbs"] - startCpuTime) * 100.0 /
                        (((now - startTimestamp) * 1000.0 * 1000.0 * 
1000.0) *
                         self.connection.host_active_processor_count()))

I changed it on mine to read

             avg = ((newStats["cpuTimeAbs"] - startCpuTime) / nSamples)
             percent = ((newStats["cpuTimeAbs"] - startCpuTime) * 100.0 /
                        (((now - startTimestamp) * 1000.0 * 1000.0 * 
1000.0)))

and it works great for me. Is this a generally useful patch to 
contribute or did I miss the point and I should have done it some other 
way? I am not quite sure what is most correct for VMs with 2 or more 
processors assigned to them, personally I don't have any, but I am 
guessing it should be divided by the number of CPUs on the VM, not the 
number of CPUs on the host.

Alan.




More information about the virt-tools-list mailing list