I've been delving a little deeper into this and certianly have a saner 
implementation for both Linux and users of Cygwin.

A couple of notes in that regard:

1. The 'ht' flag indicates that the processor has that ability, not that 
it allows you to turn it on (or that it is turned on). It's not useful for 
this purpose.
2. The this issue really only affect Linux per se, though Cygwin seems to 
have a similar issue.
3. The Cygwin environment appears to have a different presentation for 
/proc/cpuinfo than Linux, so parsing needs to be a little different.
4. The use of get_nprocs() bothers me a little since it's peculiar to the 
GCC library -- better would be simply using sysconf(_SC_NPROCESSORS_ONLN)

The advantage of using sysconf() over get_nprocs() is that it's 
compiler-neutral and should be available for all POSIX-type environments. 
The  disadvantage is that for non-POSIX environments with GCC get_nprocs() 
is probably functional. I would go with the POSIX solution if only because 
it appears that much of the rest of Ganglia already rellies on that.

I'll have a much saner implementation by Monday...

Reply via email to