Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-09 Thread Chris Lalancette
On 03/08/2010 07:19 PM, Eric Blake wrote: On 03/05/2010 12:06 PM, Chris Lalancette wrote: +#define CPU_SYS_PATH /sys/devices/system/cpu +if (virAsprintf(path, %s/cpu%d/topology/thread_siblings, CPU_SYS_PATH, +cpu) 0) { Where is the documentation about what this

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-09 Thread Jim Meyering
Eric Blake wrote: ... + +static int parse_socket(int cpu) +{ Several tools (such as ctag, or even more simply, 'git grep ^func') work better if all function implementations are listed with split lines, such that the function name starts at the first column: static int parse_socket(int

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-09 Thread Chris Lalancette
On 03/08/2010 05:29 PM, Eric Blake wrote: On 03/05/2010 12:06 PM, Chris Lalancette wrote: The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores. For the thread count,

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-09 Thread Eric Blake
On 03/09/2010 08:47 AM, Jim Meyering wrote: Eric Blake wrote: ... + +static int parse_socket(int cpu) +{ Several tools (such as ctag, or even more simply, 'git grep ^func') work better if all function implementations are listed with split lines, such that the function name starts at the

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-08 Thread Daniel Veillard
On Fri, Mar 05, 2010 at 12:03:51PM -0500, Chris Lalancette wrote: The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores. For the thread count, it always sets it to 1.

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-08 Thread Daniel Veillard
On Fri, Mar 05, 2010 at 02:06:34PM -0500, Chris Lalancette wrote: The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores. For the thread count, it always sets it to 1.

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-08 Thread Chris Lalancette
On 03/08/2010 09:22 AM, Daniel Veillard wrote: On Fri, Mar 05, 2010 at 02:06:34PM -0500, Chris Lalancette wrote: The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores.

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-08 Thread Eric Blake
On 03/05/2010 12:06 PM, Chris Lalancette wrote: The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores. For the thread count, it always sets it to 1. With more recent

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-08 Thread Eric Blake
On 03/05/2010 12:06 PM, Chris Lalancette wrote: +#define CPU_SYS_PATH /sys/devices/system/cpu +if (virAsprintf(path, %s/cpu%d/topology/thread_siblings, CPU_SYS_PATH, +cpu) 0) { Where is the documentation about what this file will contain? On my system, I see: $

[libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-05 Thread Chris Lalancette
The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores. For the thread count, it always sets it to 1. With more recent Intel machines, however, hyperthreading is again an

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-05 Thread Eric Blake
According to Chris Lalancette on 3/5/2010 10:03 AM: +static int popcnt(char x) +{ +char count; +for (count = 0; x; count++) +x = x-1; +return count; +} Gnulib provides the count-one-bits module, which does this much more efficiently (via a gcc builtin, when available;

Re: [libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-05 Thread Chris Lalancette
On 03/05/2010 12:26 PM, Eric Blake wrote: According to Chris Lalancette on 3/5/2010 10:03 AM: +static int popcnt(char x) +{ +char count; +for (count = 0; x; count++) +x = x-1; +return count; +} Gnulib provides the count-one-bits module, which does this much more

[libvirt] [PATCH] Get thread and socket information in virsh nodeinfo.

2010-03-05 Thread Chris Lalancette
The current code for nodeinfo is pretty naive about socket and thread information. To determine the sockets, it just takes the number of cpus and divides by the number of cores. For the thread count, it always sets it to 1. With more recent Intel machines, however, hyperthreading is again an