[virt-tools-list] CPU graphs

Cole Robinson crobinso at redhat.com
Tue Jul 12 14:27:47 UTC 2011


On 05/27/2011 05:56 AM, Richard W.M. Jones wrote:
> On Fri, May 27, 2011 at 09:18:48AM +0100, Alan Bell wrote:
>> 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.
> 
> I think this should be configurable.
> 
> I can see myself wanting to view it both ways: either "I've got 12
> cores, and only 1/12 of that resource is being hogged, so who cares"
> vs "why is that one guest spinning at 100%?"
> 
> Rich.
> 

I've made this configurable upstream now:

http://git.fedorahosted.org/git?p=virt-manager.git;a=commit;h=e31fa80e291d588a1946ab13618c12538af3f311

There's two CPU options under the 'View' menu now: 'Guest CPU usage' and
'Host CPU usage'. Previously 'host' was the default, but I've changed
that to 'guest', since it seems the far more intuitive choice and we've
had no end to complaints about the default behavior.

Thanks,
Cole




More information about the virt-tools-list mailing list