[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [RFC] New API to retrieve node CPU map



On 10/11/2012 01:01 AM, Viktor Mihajlovski wrote:
> 
> No problem to include flags for future extensions to be on the safe
> side. However, the map will contain all CPUs with the bits representing
> the online/offline state. If the intention is to quickly get the number
> of offline/online CPUS the following signature would be better IMO
> 
> int
> virNodeGetCpuMap(virConnectPtr conn,
>                  unsigned char **cpumap,
>          unsigned int *online,
>          unsigned int *offline,
>                  unsigned int flags);
> 

That starts to feel rather complex.

On the other hand, you have a point that returning maplen (number of
bytes allocated in the map) does NOT tell you how many cpus are online
without doing a population count of the result; worse, it cannot tell
you how many cpus are offline (a maplen of 1 is returned whether I have
4 cpus or 8 cpus, so if the map contains the value 0xb, does that mean I
had a 4 cpu machine with cpu2 off, or an 8 cpu machine with cpu2 and
cpu4-7 off?).  So allowing the user to optionally ask how many cpus are
online or offline might indeed also be useful, in addition to the maplen
needed to return the bitmap.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]