[Cmake-commits] [cmake-commits] hoffman committed DynamicLoader.cxx 1.22 1.22.10.1 SystemInformation.cxx 1.22.2.3 1.22.2.4 Terminal.c 1.8 1.8.54.1

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jun 13 08:55:20 EDT 2008


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

Modified Files:
      Tag: CMake-2-6
	DynamicLoader.cxx SystemInformation.cxx Terminal.c 
Log Message:
ENH: merge in changes from head


Index: SystemInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemInformation.cxx,v
retrieving revision 1.22.2.3
retrieving revision 1.22.2.4
diff -C 2 -d -r1.22.2.3 -r1.22.2.4
*** SystemInformation.cxx	15 May 2008 19:40:00 -0000	1.22.2.3
--- SystemInformation.cxx	13 Jun 2008 12:55:18 -0000	1.22.2.4
***************
*** 219,223 ****
    LongLong GetCyclesDifference(DELAY_FUNC, unsigned int);
  
!   // For Linux
    int RetreiveInformationFromCpuInfoFile();
    kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,
--- 219,223 ----
    LongLong GetCyclesDifference(DELAY_FUNC, unsigned int);
  
!   // For Linux and Cygwin, /proc/cpuinfo formats are slightly different
    int RetreiveInformationFromCpuInfoFile();
    kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,
***************
*** 2159,2197 ****
      }
    fclose( fd );
-   
    buffer.resize(fileSize-2);
! 
!   // Number of CPUs
    size_t pos = buffer.find("processor\t");
    while(pos != buffer.npos)
      {
      this->NumberOfLogicalCPU++;
-     this->NumberOfPhysicalCPU++;
      pos = buffer.find("processor\t",pos+1);
      }
  
!   // Count the number of physical ids that are the same
!   int currentId = -1;
!   kwsys_stl::string idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id");
! 
    while(this->CurrentPositionInFile != buffer.npos)
      {
!     int id = atoi(idc.c_str());
!     if(id == currentId)
        {
!       this->NumberOfPhysicalCPU--;
        }
!     currentId = id;
!     idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id",this->CurrentPositionInFile+1);
      }
  
!    if(this->NumberOfPhysicalCPU>0)
!      {
!      this->NumberOfLogicalCPU /= this->NumberOfPhysicalCPU;
!      }
  
    // CPU speed (checking only the first proc
    kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
!   this->CPUSpeedInMHz = (float)atof(CPUSpeed.c_str());
  
    // Chip family
--- 2159,2216 ----
      }
    fclose( fd );
    buffer.resize(fileSize-2);
!   // Number of logical CPUs (combination of multiple processors, multi-core
!   // and hyperthreading)
    size_t pos = buffer.find("processor\t");
    while(pos != buffer.npos)
      {
      this->NumberOfLogicalCPU++;
      pos = buffer.find("processor\t",pos+1);
      }
  
! #ifdef __linux
!   // Find the largest physical id.
!   int maxId = -1;
!   kwsys_stl::string idc =
!                        this->ExtractValueFromCpuInfoFile(buffer,"physical id");
    while(this->CurrentPositionInFile != buffer.npos)
      {
!       int id = atoi(idc.c_str());
!       if(id > maxId)
        {
!        maxId=id;
        }
!     idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id",
!                                             this->CurrentPositionInFile+1);
      }
+   // Physical ids returned by Linux don't distinguish cores.
+   // We want to record the total number of cores in this->NumberOfPhysicalCPU
+   // (checking only the first proc)
+   kwsys_stl::string cores =
+                         this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
+   int numberOfCoresPerCPU=atoi(cores.c_str());
+   this->NumberOfPhysicalCPU=numberOfCoresPerCPU*(maxId+1);
  
! #else // __CYGWIN__
!   // does not have "physical id" entries, neither "cpu cores"
!   // this has to be fixed for hyper-threading.  
!   kwsys_stl::string cpucount =
!     this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
!   this->NumberOfPhysicalCPU=
!     this->NumberOfLogicalCPU = atoi(cpucount.c_str());
! #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.
!   this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical=
!                             this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU;
  
    // CPU speed (checking only the first proc
    kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
!   this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
  
    // Chip family
***************
*** 2214,2219 ****
      }
    this->Features.L1CacheSize = atoi(cacheSize.c_str());
- 
- 
    return 1;
  }
--- 2233,2236 ----

Index: DynamicLoader.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/DynamicLoader.cxx,v
retrieving revision 1.22
retrieving revision 1.22.10.1
diff -C 2 -d -r1.22 -r1.22.10.1
*** DynamicLoader.cxx	1 Aug 2007 14:07:46 -0000	1.22
--- DynamicLoader.cxx	13 Jun 2008 12:55:18 -0000	1.22.10.1
***************
*** 306,310 ****
  const char* DynamicLoader::LastError()
  {
!   LPVOID lpMsgBuf;
  
    FormatMessage(
--- 306,310 ----
  const char* DynamicLoader::LastError()
  {
!   LPVOID lpMsgBuf=NULL;
  
    FormatMessage(
***************
*** 318,321 ****
--- 318,326 ----
      );
  
+   if(!lpMsgBuf)
+     {
+     return NULL;
+     }
+ 
    static char* str = 0;
    delete [] str;

Index: Terminal.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/Terminal.c,v
retrieving revision 1.8
retrieving revision 1.8.54.1
diff -C 2 -d -r1.8 -r1.8.54.1
*** Terminal.c	23 Aug 2006 13:47:43 -0000	1.8
--- Terminal.c	13 Jun 2008 12:55:18 -0000	1.8.54.1
***************
*** 142,159 ****
    "con80x50",
    "con80x60",
    "console",
    "cygwin",
    "konsole",
    "konsole-256color",
    "linux",
    "msys",
    "rxvt",
    "rxvt-unicode",
    "screen",
    "screen-256color",
    "vt100",
    "xterm",
!   "xterm-color",
    "xterm-256color",
    0
  };
--- 142,177 ----
    "con80x50",
    "con80x60",
+   "cons25",
    "console",
    "cygwin",
+   "dtterm",
+   "eterm-color",
+   "gnome",
+   "gnome-256color",
    "konsole",
    "konsole-256color",
+   "kterm",
    "linux",
    "msys",
+   "linux-c",
+   "mach-color",
+   "mlterm",
+   "putty",
    "rxvt",
+   "rxvt-cygwin",
+   "rxvt-cygwin-native",
    "rxvt-unicode",
    "screen",
    "screen-256color",
+   "screen-bce",
+   "screen-w",
+   "screen.linux",
    "vt100",
    "xterm",
!   "xterm-16color",
    "xterm-256color",
+   "xterm-88color",
+   "xterm-color",
+   "xterm-debian",
    0
  };



More information about the Cmake-commits mailing list