kvm_stat: Only consider online cpus
commit763952d08b9c89726151a72f90bca90d0828302d
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 17 Jun 2014 07:54:30 +0000 (17 17:54 +1000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 31 Oct 2014 15:13:21 +0000 (31 16:13 +0100)
tree65ca373f4319ac16e7658c6d77bec13a37a99621
parent0ba1f53191221b541b938df86a39eeccfb87f996
kvm_stat: Only consider online cpus

In kvm_stat we grovel through /sys to find out how many cpus are in the
system. However if a cpu is offline it will still be present in /sys,
and the perf_event_open() will fail.

Modify the logic to only return online cpus. We need to be careful on
systems which don't support cpu hotplug, the online file will not be
present at all.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
scripts/kvm/kvm_stat