COMP:Fixed warnings with gcc 4.3.2.
This commit is contained in:
parent
55a6042d9c
commit
ad4a2fd697
|
@ -104,7 +104,7 @@ public:
|
||||||
const char * GetExtendedProcessorName();
|
const char * GetExtendedProcessorName();
|
||||||
const char * GetProcessorSerialNumber();
|
const char * GetProcessorSerialNumber();
|
||||||
int GetProcessorCacheSize();
|
int GetProcessorCacheSize();
|
||||||
int GetLogicalProcessorsPerPhysical();
|
unsigned int GetLogicalProcessorsPerPhysical();
|
||||||
float GetProcessorClockFrequency();
|
float GetProcessorClockFrequency();
|
||||||
int GetProcessorAPICID();
|
int GetProcessorAPICID();
|
||||||
int GetProcessorCacheXSize(long int);
|
int GetProcessorCacheXSize(long int);
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
bool HasMMXPlus;
|
bool HasMMXPlus;
|
||||||
bool HasSSEMMX;
|
bool HasSSEMMX;
|
||||||
bool SupportsHyperthreading;
|
bool SupportsHyperthreading;
|
||||||
int LogicalProcessorsPerPhysical;
|
unsigned int LogicalProcessorsPerPhysical;
|
||||||
int APIC_ID;
|
int APIC_ID;
|
||||||
CPUPowerManagement PowerManagement;
|
CPUPowerManagement PowerManagement;
|
||||||
} CPUExtendedFeatures;
|
} CPUExtendedFeatures;
|
||||||
|
@ -317,7 +317,7 @@ int SystemInformation::GetProcessorCacheSize()
|
||||||
{
|
{
|
||||||
return this->Implementation->GetProcessorCacheSize();
|
return this->Implementation->GetProcessorCacheSize();
|
||||||
}
|
}
|
||||||
int SystemInformation::GetLogicalProcessorsPerPhysical()
|
unsigned int SystemInformation::GetLogicalProcessorsPerPhysical()
|
||||||
{
|
{
|
||||||
return this->Implementation->GetLogicalProcessorsPerPhysical();
|
return this->Implementation->GetLogicalProcessorsPerPhysical();
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ const char * SystemInformationImplementation::GetProcessorSerialNumber()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the logical processors per physical */
|
/** Return the logical processors per physical */
|
||||||
int SystemInformationImplementation::GetLogicalProcessorsPerPhysical()
|
unsigned int SystemInformationImplementation::GetLogicalProcessorsPerPhysical()
|
||||||
{
|
{
|
||||||
return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical;
|
return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical;
|
||||||
}
|
}
|
||||||
|
@ -1563,7 +1563,7 @@ bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if what we are about to do is supported...
|
// Check to see if what we are about to do is supported...
|
||||||
if (!RetrieveCPUExtendedLevelSupport (0x80000001))
|
if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000001)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1698,7 +1698,7 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber()
|
||||||
bool SystemInformationImplementation::RetrieveCPUPowerManagement()
|
bool SystemInformationImplementation::RetrieveCPUPowerManagement()
|
||||||
{
|
{
|
||||||
// Check to see if what we are about to do is supported...
|
// Check to see if what we are about to do is supported...
|
||||||
if (!RetrieveCPUExtendedLevelSupport (0x80000007))
|
if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000007)))
|
||||||
{
|
{
|
||||||
this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID = false;
|
this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID = false;
|
||||||
this->Features.ExtendedFeatures.PowerManagement.HasVoltageID = false;
|
this->Features.ExtendedFeatures.PowerManagement.HasVoltageID = false;
|
||||||
|
@ -1755,9 +1755,12 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
|
||||||
bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
|
bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
|
||||||
{
|
{
|
||||||
// Check to see if what we are about to do is supported...
|
// Check to see if what we are about to do is supported...
|
||||||
if (!RetrieveCPUExtendedLevelSupport(0x80000002)) return false;
|
if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000002)))
|
||||||
if (!RetrieveCPUExtendedLevelSupport(0x80000003)) return false;
|
return false;
|
||||||
if (!RetrieveCPUExtendedLevelSupport(0x80000004)) return false;
|
if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000003)))
|
||||||
|
return false;
|
||||||
|
if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000004)))
|
||||||
|
return false;
|
||||||
|
|
||||||
#if USE_ASM_INSTRUCTIONS
|
#if USE_ASM_INSTRUCTIONS
|
||||||
int ProcessorNameStartPos = 0;
|
int ProcessorNameStartPos = 0;
|
||||||
|
@ -2169,7 +2172,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
|
||||||
size_t fileSize = 0;
|
size_t fileSize = 0;
|
||||||
while(!feof(fd))
|
while(!feof(fd))
|
||||||
{
|
{
|
||||||
buffer += static_cast<unsigned char>(fgetc(fd));
|
buffer += static_cast<char>(fgetc(fd));
|
||||||
fileSize++;
|
fileSize++;
|
||||||
}
|
}
|
||||||
fclose( fd );
|
fclose( fd );
|
||||||
|
@ -2204,7 +2207,8 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
|
||||||
kwsys_stl::string cores =
|
kwsys_stl::string cores =
|
||||||
this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
|
this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
|
||||||
int numberOfCoresPerCPU=atoi(cores.c_str());
|
int numberOfCoresPerCPU=atoi(cores.c_str());
|
||||||
this->NumberOfPhysicalCPU=numberOfCoresPerCPU*(maxId+1);
|
this->NumberOfPhysicalCPU=static_cast<unsigned int>(
|
||||||
|
numberOfCoresPerCPU*(maxId+1));
|
||||||
|
|
||||||
#else // __CYGWIN__
|
#else // __CYGWIN__
|
||||||
// does not have "physical id" entries, neither "cpu cores"
|
// does not have "physical id" entries, neither "cpu cores"
|
||||||
|
@ -2328,34 +2332,63 @@ int SystemInformationImplementation::QueryMemory()
|
||||||
// Rigorously, this test should check from the developping version 2.5.x
|
// Rigorously, this test should check from the developping version 2.5.x
|
||||||
// that introduced the new format...
|
// that introduced the new format...
|
||||||
|
|
||||||
long freeMem;
|
unsigned long freeMem;
|
||||||
long buffersMem;
|
unsigned long buffersMem;
|
||||||
long cachedMem;
|
unsigned long cachedMem;
|
||||||
|
|
||||||
fscanf(fd,"MemTotal:%ld kB\n", &this->TotalPhysicalMemory);
|
int status;
|
||||||
fscanf(fd,"MemFree:%ld kB\n", &freeMem);
|
|
||||||
fscanf(fd,"Buffers:%ld kB\n", &buffersMem);
|
|
||||||
fscanf(fd,"Cached:%ld kB\n", &cachedMem);
|
|
||||||
|
|
||||||
|
status=fscanf(fd,"MemTotal:%lu kB\n", &this->TotalPhysicalMemory);
|
||||||
|
if(status==1)
|
||||||
|
{
|
||||||
|
status+=fscanf(fd,"MemFree:%lu kB\n", &freeMem);
|
||||||
|
}
|
||||||
|
if(status==2)
|
||||||
|
{
|
||||||
|
status+=fscanf(fd,"Buffers:%lu kB\n", &buffersMem);
|
||||||
|
}
|
||||||
|
if(status==3)
|
||||||
|
{
|
||||||
|
status+=fscanf(fd,"Cached:%lu kB\n", &cachedMem);
|
||||||
|
}
|
||||||
|
if(status==4)
|
||||||
|
{
|
||||||
this->TotalPhysicalMemory /= 1024;
|
this->TotalPhysicalMemory /= 1024;
|
||||||
this->AvailablePhysicalMemory = freeMem+cachedMem+buffersMem;
|
this->AvailablePhysicalMemory = freeMem+cachedMem+buffersMem;
|
||||||
this->AvailablePhysicalMemory /= 1024;
|
this->AvailablePhysicalMemory /= 1024;
|
||||||
|
}
|
||||||
|
|
||||||
// Skip SwapCached, Active, Inactive, HighTotal, HighFree, LowTotal
|
// Skip SwapCached, Active, Inactive, HighTotal, HighFree, LowTotal
|
||||||
// and LowFree.
|
// and LowFree.
|
||||||
int i=0;
|
int i=0;
|
||||||
while(i<7)
|
bool success=status==4;
|
||||||
|
while(i<7 && success)
|
||||||
{
|
{
|
||||||
fgets(buffer, sizeof(buffer), fd); // skip a line
|
char *r=fgets(buffer, sizeof(buffer), fd); // skip a line
|
||||||
|
success=r==buffer;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
fscanf(fd,"SwapTotal:%ld kB\n", &this->TotalVirtualMemory);
|
if(success)
|
||||||
fscanf(fd,"SwapFree:%ld kB\n", &this->AvailableVirtualMemory);
|
{
|
||||||
|
status+=fscanf(fd,"SwapTotal:%lu kB\n", &this->TotalVirtualMemory);
|
||||||
|
}
|
||||||
|
if(status==5)
|
||||||
|
{
|
||||||
|
status+=fscanf(fd,"SwapFree:%lu kB\n", &this->AvailableVirtualMemory);
|
||||||
|
}
|
||||||
|
if(status==6)
|
||||||
|
{
|
||||||
this->TotalVirtualMemory /= 1024;
|
this->TotalVirtualMemory /= 1024;
|
||||||
this->AvailableVirtualMemory /= 1024;
|
this->AvailableVirtualMemory /= 1024;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl;
|
||||||
|
fclose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// /proc/meminfo format for kernel older than 2.6.x
|
// /proc/meminfo format for kernel older than 2.6.x
|
||||||
|
@ -2363,17 +2396,31 @@ int SystemInformationImplementation::QueryMemory()
|
||||||
unsigned long temp;
|
unsigned long temp;
|
||||||
unsigned long cachedMem;
|
unsigned long cachedMem;
|
||||||
unsigned long buffersMem;
|
unsigned long buffersMem;
|
||||||
fgets(buffer, sizeof(buffer), fd); // Skip "total: used:..."
|
char *r=fgets(buffer, sizeof(buffer), fd); // Skip "total: used:..."
|
||||||
|
int status=0;
|
||||||
fscanf(fd, "Mem: %lu %lu %lu %lu %lu %lu\n",
|
if(r==buffer)
|
||||||
|
{
|
||||||
|
status+=fscanf(fd, "Mem: %lu %lu %lu %lu %lu %lu\n",
|
||||||
&tp, &temp, &ap, &temp, &buffersMem, &cachedMem);
|
&tp, &temp, &ap, &temp, &buffersMem, &cachedMem);
|
||||||
fscanf(fd, "Swap: %lu %lu %lu\n", &tv, &temp, &av);
|
}
|
||||||
|
if(status==6)
|
||||||
|
{
|
||||||
|
status+=fscanf(fd, "Swap: %lu %lu %lu\n", &tv, &temp, &av);
|
||||||
|
}
|
||||||
|
if(status==9)
|
||||||
|
{
|
||||||
this->TotalVirtualMemory = tv>>10>>10;
|
this->TotalVirtualMemory = tv>>10>>10;
|
||||||
this->TotalPhysicalMemory = tp>>10>>10;
|
this->TotalPhysicalMemory = tp>>10>>10;
|
||||||
this->AvailableVirtualMemory = av>>10>>10;
|
this->AvailableVirtualMemory = av>>10>>10;
|
||||||
this->AvailablePhysicalMemory = (ap+buffersMem+cachedMem)>>10>>10;
|
this->AvailablePhysicalMemory = (ap+buffersMem+cachedMem)>>10>>10;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl;
|
||||||
|
fclose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
fclose( fd );
|
fclose( fd );
|
||||||
return 1;
|
return 1;
|
||||||
#elif __hpux
|
#elif __hpux
|
||||||
|
@ -2725,13 +2772,14 @@ bool SystemInformationImplementation::ParseSysCtl()
|
||||||
this->SysCtlBuffer = this->RunProcess(args);
|
this->SysCtlBuffer = this->RunProcess(args);
|
||||||
|
|
||||||
// Parse values for Mac
|
// Parse values for Mac
|
||||||
this->TotalPhysicalMemory = atoi(this->ExtractValueFromSysCtl("hw.memsize:").c_str())/(1024*1024);
|
this->TotalPhysicalMemory = static_cast<unsigned long>(
|
||||||
|
atoi(this->ExtractValueFromSysCtl("hw.memsize:").c_str())/(1024*1024));
|
||||||
this->TotalVirtualMemory = 0;
|
this->TotalVirtualMemory = 0;
|
||||||
this->AvailablePhysicalMemory = 0;
|
this->AvailablePhysicalMemory = 0;
|
||||||
this->AvailableVirtualMemory = 0;
|
this->AvailableVirtualMemory = 0;
|
||||||
|
|
||||||
this->NumberOfPhysicalCPU = atoi(this->ExtractValueFromSysCtl("hw.physicalcpu:").c_str());
|
this->NumberOfPhysicalCPU = static_cast<unsigned int>(atoi(this->ExtractValueFromSysCtl("hw.physicalcpu:").c_str()));
|
||||||
this->NumberOfLogicalCPU = atoi(this->ExtractValueFromSysCtl("hw.logicalcpu:").c_str());
|
this->NumberOfLogicalCPU = static_cast<unsigned int>(atoi(this->ExtractValueFromSysCtl("hw.logicalcpu:").c_str()));
|
||||||
|
|
||||||
if(this->NumberOfPhysicalCPU!=0)
|
if(this->NumberOfPhysicalCPU!=0)
|
||||||
{
|
{
|
||||||
|
@ -2908,7 +2956,8 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
|
||||||
bool SystemInformationImplementation::QuerySolarisInfo()
|
bool SystemInformationImplementation::QuerySolarisInfo()
|
||||||
{
|
{
|
||||||
// Parse values
|
// Parse values
|
||||||
this->NumberOfPhysicalCPU = atoi(this->ParseValueFromKStat("-n syste_misc -s ncpus").c_str());
|
this->NumberOfPhysicalCPU = static_cast<unsigned int>(
|
||||||
|
atoi(this->ParseValueFromKStat("-n syste_misc -s ncpus").c_str()));
|
||||||
this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
|
this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
|
||||||
|
|
||||||
if(this->NumberOfPhysicalCPU!=0)
|
if(this->NumberOfPhysicalCPU!=0)
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
const char * GetExtendedProcessorName();
|
const char * GetExtendedProcessorName();
|
||||||
const char * GetProcessorSerialNumber();
|
const char * GetProcessorSerialNumber();
|
||||||
int GetProcessorCacheSize();
|
int GetProcessorCacheSize();
|
||||||
int GetLogicalProcessorsPerPhysical();
|
unsigned int GetLogicalProcessorsPerPhysical();
|
||||||
float GetProcessorClockFrequency();
|
float GetProcessorClockFrequency();
|
||||||
int GetProcessorAPICID();
|
int GetProcessorAPICID();
|
||||||
int GetProcessorCacheXSize(long int);
|
int GetProcessorCacheXSize(long int);
|
||||||
|
|
Loading…
Reference in New Issue