[libvirt] [RFC][PATCHv1 0/5] libvirt - show per cpu accounting information
KAMEZAWA Hiroyuki
kamezawa.hiroyu at jp.fujitsu.com
Fri Apr 15 07:02:17 UTC 2011
When running 'virt-top -1' , "show percpu statistics mode",
virt-top shows a fake value.
When running 'while true; do echo hello;done' on a 4vcpu guest,
==
0 0.0
1 0.0
2 0.0
3 0.0
4 25.0 25.0=
5 25.0 25.0=#
6 25.0 25.0=
7 25.0 25.0=
==
All cpus just used equally ;)
This is because there is no interface to get per-cpu usage of domain.
This patch adds an interface virDomainPcpuStats() to get per-cpu
statistics, cpuTime in nanoseconds.
Here is a test result with a python script using new interface.
==
[root at bluextal python]# ./virt-cpuacct.py
({'cpuTime': 0L}, {'cpuTime': 0L}, {'cpuTime': 0L}, {'cpuTime': 0L}, {'cpuTime': 4679204346L}, {'cpuTime': 2103820380L}, {'cpuTime': 8904513019L}, {'cpuTime': 7424701195L})
[root at bluextal python]# ./virt-cpuacct.py
({'cpuTime': 0L}, {'cpuTime': 0L}, {'cpuTime': 0L}, {'cpuTime': 0L}, {'cpuTime': 57010689139L}, {'cpuTime': 26152907202L}, {'cpuTime': 53759693931L}, {'cpuTime': 43074348218L})
==
Although I added a new interface, I still wonder what interface is better...
any comments are welcome.
Thanks,
-Kame
More information about the libvir-list
mailing list