[Jeffee Kiser] 
I would rely on another means (especially the environment variable method) for getting the number of processors.  Hyperthreading is enabled/disabled in the BIOS so it's not an OS dependent thing.
 
I checked my machines that have hyperthreading on and Dave Roth's Win32::AdminMisc module still gets the number of processors right (they are dual processor machines; the %ENV shows them as 4 processors but
 
use Win32::AdminMisc;
%cpuinfo = Win32::AdminMisc::GetProcessorInfo();
print "# of processors: $cpuinfo{ProcessorNum}\n";
 
If you don't want to install this module (I'm not sure if its bundled with ActivePerl or if I installed it through www.roth.net ), you can still get this information by just combing the registry:
 
use Win32::Registry;
my $path = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
if($HKEY_LOCAL_MACHINE->Open($path,$regkey)) {
 $regkey->GetKeys([EMAIL PROTECTED]);
 my $nprocs = scalar(@items);
 $regkey->Close();
 print "# processors: $nprocs\n";
} else {
 die "Could not open registry key to $path\n";
}
 
 
I'm writing a script that will collect information about a server.  It is really easy to get the number of processors either through the ENV array or through Win32::Systeminfo.  But with hyper-threading of course you get double the number of processors. 
 
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to