[libvirt] Can not get domain's cpu time

Hi, I have a domain running in my KVM box, and try to get its vcpu info by calling virDomainGetVcpus(), but it seems the cpu time returned to me is always 0. And I also found virsh can not get the CPU time too: $ virsh vcpuinfo aaa VCPU: 0 CPU: 0 State: running CPU Affinity: yy I tried the same virsh command in my Xen box for a running domain, the output is: $ virsh vcpuinfo test1 VCPU: 0 CPU: 1 State: running CPU time: 322.1s <----- I need this CPU Affinity: yy As you see, for KVM domain, there is no "CPU time". But it's very strange that virt-manager can show the right CPU usage for my running domain, I do not know where virt-manger gets it. Can anyone tell me which libvirt API should I call to get the CPU time? Thanks! Regards, Qian

Zhang Qian wrote:
Hi,
I have a domain running in my KVM box, and try to get its vcpu info by calling virDomainGetVcpus(), but it seems the cpu time returned to me is always 0.
And I also found virsh can not get the CPU time too: $ virsh vcpuinfo aaa VCPU: 0 CPU: 0 State: running CPU Affinity: yy
I tried the same virsh command in my Xen box for a running domain, the output is: $ virsh vcpuinfo test1 VCPU: 0 CPU: 1 State: running CPU time: 322.1s <----- I need this CPU Affinity: yy
As you see, for KVM domain, there is no "CPU time". But it's very strange that virt-manager can show the right CPU usage for my running domain, I do not know where virt-manger gets it.
Can anyone tell me which libvirt API should I call to get the CPU time? Thanks!
Regards, Qian
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
virDomainGetVcpus() is NOT supported by KVM For driver support status, please refer to http://libvirt.org/hvsupport.html

On Thu, Jul 16, 2009 at 05:15:23PM +0800, Jason Wong wrote:
Zhang Qian wrote:
Hi,
I have a domain running in my KVM box, and try to get its vcpu info by calling virDomainGetVcpus(), but it seems the cpu time returned to me is always 0.
And I also found virsh can not get the CPU time too: $ virsh vcpuinfo aaa VCPU: 0 CPU: 0 State: running CPU Affinity: yy
I tried the same virsh command in my Xen box for a running domain, the output is: $ virsh vcpuinfo test1 VCPU: 0 CPU: 1 State: running CPU time: 322.1s <----- I need this CPU Affinity: yy
As you see, for KVM domain, there is no "CPU time". But it's very strange that virt-manager can show the right CPU usage for my running domain, I do not know where virt-manger gets it.
Can anyone tell me which libvirt API should I call to get the CPU time? Thanks!
Regards, Qian
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
virDomainGetVcpus() is NOT supported by KVM
It is supported, but we don't fill in all the fields :-( Basically it only gives youthe vCPU <-> pCPU affinity info at this time
For driver support status, please refer to http://libvirt.org/hvsupport.html
That's actually out of date :-( Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Jul 16, 2009 at 05:04:01PM +0800, Zhang Qian wrote:
Hi,
I have a domain running in my KVM box, and try to get its vcpu info by calling virDomainGetVcpus(), but it seems the cpu time returned to me is always 0.
And I also found virsh can not get the CPU time too: $ virsh vcpuinfo aaa VCPU: 0 CPU: 0 State: running CPU Affinity: yy
I tried the same virsh command in my Xen box for a running domain, the output is: $ virsh vcpuinfo test1 VCPU: 0 CPU: 1 State: running CPU time: 322.1s <----- I need this CPU Affinity: yy
As you see, for KVM domain, there is no "CPU time". But it's very strange that virt-manager can show the right CPU usage for my running domain, I do not know where virt-manger gets it.
virt-manager only shows the CPU time for the whole guest (virsh dominfo). Here you are asking for the per-vCPU time, which we've not implemented for QEMU yet. We should fix this missing support... Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (3)
-
Daniel P. Berrange
-
Jason Wong
-
Zhang Qian