[Cmake-commits] [cmake-commits] hoffman committed SystemInformation.cxx 1.29 1.30

cmake-commits at cmake.org cmake-commits at cmake.org
Sun Jun 1 11:23:24 EDT 2008


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv32098

Modified Files:
	SystemInformation.cxx 
Log Message:
ENH: avoid divide by zero, temporary fix until cygwin cpu file is read better, bad cpu info is better than a crash


Index: SystemInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemInformation.cxx,v
retrieving revision 1.29
retrieving revision 1.30
diff -C 2 -d -r1.29 -r1.30
*** SystemInformation.cxx	31 May 2008 15:23:15 -0000	1.29
--- SystemInformation.cxx	1 Jun 2008 15:23:22 -0000	1.30
***************
*** 2159,2165 ****
      }
    fclose( fd );
-   
    buffer.resize(fileSize-2);
- 
    // Number of logical CPUs (combination of multiple processors, multi-core
    // and hyperthreading)
--- 2159,2163 ----
***************
*** 2185,2189 ****
                                              this->CurrentPositionInFile+1);
      }
- 
    // Physical ids returned by Linux don't distinguish cores.
    // We want to record the total number of cores in this->NumberOfPhysicalCPU
--- 2183,2186 ----
***************
*** 2192,2198 ****
                          this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
    int numberOfCoresPerCPU=atoi(cores.c_str());
- 
    this->NumberOfPhysicalCPU=numberOfCoresPerCPU*(maxId+1);
! 
    // LogicalProcessorsPerPhysical>1 => hyperthreading.
    this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical=
--- 2189,2198 ----
                          this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
    int numberOfCoresPerCPU=atoi(cores.c_str());
    this->NumberOfPhysicalCPU=numberOfCoresPerCPU*(maxId+1);
!   // have to have one, and need to avoid divied by zero
!   if(this->NumberOfPhysicalCPU <= 0)
!     {
!     this->NumberOfPhysicalCPU = 1;
!     }
    // LogicalProcessorsPerPhysical>1 => hyperthreading.
    this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical=
***************
*** 2222,2227 ****
      }
    this->Features.L1CacheSize = atoi(cacheSize.c_str());
- 
- 
    return 1;
  }
--- 2222,2225 ----



More information about the Cmake-commits mailing list