[virt-tools-list] CPU graphs
Richard W.M. Jones
rjones at redhat.com
Fri May 27 09:56:54 UTC 2011
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.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
More information about the virt-tools-list
mailing list