summaryrefslogtreecommitdiffstats
path: root/SystemInformation.cxx
diff options
context:
space:
mode:
authorKWSys Robot <kwrobot@kitware.com>2013-12-19 14:39:26 (GMT)
committerBrad King <brad.king@kitware.com>2013-12-19 15:44:24 (GMT)
commitf788d9a1b27efc9b463b1174a93e780bef00a5d9 (patch)
treead8871c410d7cc02d04c19be76465db32aab8dca /SystemInformation.cxx
parent704ab3d24827cfe5754a00028086f21503c2e08b (diff)
downloadCMake-f788d9a1b27efc9b463b1174a93e780bef00a5d9.zip
CMake-f788d9a1b27efc9b463b1174a93e780bef00a5d9.tar.gz
CMake-f788d9a1b27efc9b463b1174a93e780bef00a5d9.tar.bz2
KWSys 2013-12-19 (88165c5e)
Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 88165c5e | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 1010d0e3..88165c5e Clinton Stimpson (2): ab6f8c36 FStream: Fix rdbuf() return and use use of FStream in SystemTools. 88165c5e Encoding: Fix bug in kwsysEncoding_DupToNarrow. Rolf Eike Beer (2): d2bcbe11 SystemInformation: extract CPU information on Linux/Sparc b2fd7da5 ProcessUNIX: close /proc entry before starting recursion Ådne Hovda (1): a02a1ad2 SystemInformation: Fix compilation on HP-UX 11.11 hppa Change-Id: I225e0517379d88612f18215b43c7d6a9daad6326
Diffstat (limited to 'SystemInformation.cxx')
-rw-r--r--SystemInformation.cxx32
1 files changed, 29 insertions, 3 deletions
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 2f6c949..5f20853 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -3162,8 +3162,17 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
kwsys_stl::string cores =
this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
int numberOfCoresPerCPU=atoi(cores.c_str());
- this->NumberOfPhysicalCPU=static_cast<unsigned int>(
- numberOfCoresPerCPU*(maxId+1));
+ if (maxId > 0)
+ {
+ this->NumberOfPhysicalCPU=static_cast<unsigned int>(
+ numberOfCoresPerCPU*(maxId+1));
+ }
+ else
+ {
+ // Linux Sparc: get cpu count
+ this->NumberOfPhysicalCPU=
+ atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
+ }
#else // __CYGWIN__
// does not have "physical id" entries, neither "cpu cores"
@@ -3185,7 +3194,19 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// CPU speed (checking only the first processor)
kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
- this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
+ if(!CPUSpeed.empty())
+ {
+ this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
+ }
+#ifdef __linux
+ else
+ {
+ // Linux Sparc: CPU speed is in Hz and encoded in hexadecimal
+ CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"Cpu0ClkTck");
+ this->CPUSpeedInMHz = static_cast<float>(
+ strtoull(CPUSpeed.c_str(),0,16))/1000000.0f;
+ }
+#endif
// Chip family
kwsys_stl::string familyStr =
@@ -4991,7 +5012,12 @@ bool SystemInformationImplementation::QueryHPUXProcessor()
case CPU_PA_RISC2_0:
this->ChipID.Vendor = "Hewlett-Packard";
this->ChipID.Family = 0x200;
+# ifdef CPU_HP_INTEL_EM_1_0
+ case CPU_HP_INTEL_EM_1_0:
+# endif
+# ifdef CPU_IA64_ARCHREV_0
case CPU_IA64_ARCHREV_0:
+# endif
this->ChipID.Vendor = "GenuineIntel";
this->Features.HasIA64 = true;
break;