[libvirt] [PATCH] BSD: implement nodeGetCPUStats

Daniel P. Berrange berrange at redhat.com
Tue Jan 14 11:15:17 UTC 2014


On Tue, Jan 14, 2014 at 12:47:20PM +0400, Roman Bogorodskiy wrote:
> I had doubts how to implement that. Looks like the current
> implementation is tied to Linux CPU metrics:
> 
>   user nice system idle iowait
> 
> That list is hardcoded into virsh-host.c. FreeBSD has a slightly
> different set of metrics:
> 
>   user nice system intr idle
> 
> I.e. it's interrupt time instead of i/o time.

That's not a problem. Just define a new API constant for INTR and
don't use the IOWAIT constant in your impl. No impl is required to
support every single possible value.

>                                              I decided to go without
> virsh-host.c modification and used VIR_NODE_CPU_STATS_UTILIZATION.

I'd avoid using that. It only exists for virt which is incapable of
providing the raw values. It is much better to let the apps calculate
the utilization themselves since they can choose the time period over
which to perform the calculation better.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list