ENH: fix crash on dash17 linux where the parsing of the proc file must not have worked right

This commit is contained in:
Bill Hoffman 2008-06-01 23:40:30 -04:00
parent 735b77798d
commit 2f082668bd
1 changed files with 6 additions and 1 deletions

View File

@ -2199,7 +2199,12 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->NumberOfPhysicalCPU= this->NumberOfPhysicalCPU=
this->NumberOfLogicalCPU = atoi(cpucount.c_str()); this->NumberOfLogicalCPU = atoi(cpucount.c_str());
#endif #endif
// gotta have one, and if this is 0 then we get a / by 0n
// beter to have a bad answer than a crash
if(this->NumberOfPhysicalCPU <= 0)
{
this->NumberOfPhysicalCPU = 1;
}
// LogicalProcessorsPerPhysical>1 => hyperthreading. // LogicalProcessorsPerPhysical>1 => hyperthreading.
this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical= this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical=
this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU; this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU;