diff options
author | Chris Lalancette <clalance@redhat.com> | 2010-03-04 17:28:40 -0500 |
---|---|---|
committer | Chris Lalancette <clalance@redhat.com> | 2010-03-08 09:26:04 -0500 |
commit | aa2f6f96ddd7a57011c3d25586d588100651feb2 (patch) | |
tree | 1fc7f8afcfc6ccaae4b5115a62cad5c96d14a84e /tests/nodeinfotest.c | |
parent | Fix locking in qemudDomainMemoryStats (diff) | |
download | libvirt-aa2f6f96ddd7a57011c3d25586d588100651feb2.tar.gz libvirt-aa2f6f96ddd7a57011c3d25586d588100651feb2.tar.bz2 libvirt-aa2f6f96ddd7a57011c3d25586d588100651feb2.zip |
Get thread and socket information in virsh nodeinfo.
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 option, meaning that these
heuristics no longer work and give bogus numbers. This
patch goes through /sys to get the additional
information so we properly report it.
Note that I had to edit the tests not to report on
socket and thread counts, since these are determined
dynamically now.
v2: As pointed out by Eric Blake, gnulib provides
count-one-bits (which is LGPLv2+). Use it instead
of a hand-coded popcnt.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Diffstat (limited to 'tests/nodeinfotest.c')
-rw-r--r-- | tests/nodeinfotest.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index 4cb248acf..b3b91ad3b 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -47,9 +47,8 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile fclose(cpuinfo); snprintf(actualData, MAX_FILE, - "CPUs: %u, MHz: %u, Nodes: %u, Sockets: %u, Cores: %u, Threads: %u\n", - nodeinfo.cpus, nodeinfo.mhz, nodeinfo.nodes, nodeinfo.sockets, - nodeinfo.cores, nodeinfo.threads); + "CPUs: %u, MHz: %u, Nodes: %u, Cores: %u\n", + nodeinfo.cpus, nodeinfo.mhz, nodeinfo.nodes, nodeinfo.cores); if (STRNEQ(actualData, expectData)) { if (getenv("DEBUG_TESTS")) { |