Commit d2bcbe11 authored by Rolf Eike Beer's avatar Rolf Eike Beer

SystemInformation: extract CPU information on Linux/Sparc

Change-Id: I9a6ce9af30dae548e860636ad64164200ba91f49
parent 1010d0e3
......@@ -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 =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment