|
@@ -132,7 +132,7 @@ typedef int siginfo_t;
|
|
|
# endif
|
|
# endif
|
|
|
# endif
|
|
# endif
|
|
|
# if defined(KWSYS_CXX_HAS_RLIMIT64)
|
|
# if defined(KWSYS_CXX_HAS_RLIMIT64)
|
|
|
-typedef struct rlimit64 ResourceLimitType;
|
|
|
|
|
|
|
+using ResourceLimitType = struct rlimit64;
|
|
|
# define GetResourceLimit getrlimit64
|
|
# define GetResourceLimit getrlimit64
|
|
|
# else
|
|
# else
|
|
|
typedef struct rlimit ResourceLimitType;
|
|
typedef struct rlimit ResourceLimitType;
|
|
@@ -303,34 +303,34 @@ T min(T a, T b)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
extern "C" {
|
|
extern "C" {
|
|
|
-typedef void (*SigAction)(int, siginfo_t*, void*);
|
|
|
|
|
|
|
+using SigAction = void (*)(int, siginfo_t*, void*);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Define SystemInformationImplementation class
|
|
// Define SystemInformationImplementation class
|
|
|
-typedef void (*DELAY_FUNC)(unsigned int uiMS);
|
|
|
|
|
|
|
+using DELAY_FUNC = void (*)(unsigned int);
|
|
|
|
|
|
|
|
class SystemInformationImplementation
|
|
class SystemInformationImplementation
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- typedef SystemInformation::LongLong LongLong;
|
|
|
|
|
|
|
+ using LongLong = SystemInformation::LongLong;
|
|
|
SystemInformationImplementation();
|
|
SystemInformationImplementation();
|
|
|
- ~SystemInformationImplementation();
|
|
|
|
|
|
|
+ ~SystemInformationImplementation() = default;
|
|
|
|
|
|
|
|
- const char* GetVendorString();
|
|
|
|
|
|
|
+ const char* GetVendorString() const;
|
|
|
const char* GetVendorID();
|
|
const char* GetVendorID();
|
|
|
- std::string GetTypeID();
|
|
|
|
|
- std::string GetFamilyID();
|
|
|
|
|
- std::string GetModelID();
|
|
|
|
|
- std::string GetModelName();
|
|
|
|
|
- std::string GetSteppingCode();
|
|
|
|
|
- const char* GetExtendedProcessorName();
|
|
|
|
|
- const char* GetProcessorSerialNumber();
|
|
|
|
|
- int GetProcessorCacheSize();
|
|
|
|
|
- unsigned int GetLogicalProcessorsPerPhysical();
|
|
|
|
|
- float GetProcessorClockFrequency();
|
|
|
|
|
- int GetProcessorAPICID();
|
|
|
|
|
- int GetProcessorCacheXSize(long int);
|
|
|
|
|
- bool DoesCPUSupportFeature(long int);
|
|
|
|
|
|
|
+ std::string GetTypeID() const;
|
|
|
|
|
+ std::string GetFamilyID() const;
|
|
|
|
|
+ std::string GetModelID() const;
|
|
|
|
|
+ std::string GetModelName() const;
|
|
|
|
|
+ std::string GetSteppingCode() const;
|
|
|
|
|
+ const char* GetExtendedProcessorName() const;
|
|
|
|
|
+ const char* GetProcessorSerialNumber() const;
|
|
|
|
|
+ int GetProcessorCacheSize() const;
|
|
|
|
|
+ unsigned int GetLogicalProcessorsPerPhysical() const;
|
|
|
|
|
+ float GetProcessorClockFrequency() const;
|
|
|
|
|
+ int GetProcessorAPICID() const;
|
|
|
|
|
+ int GetProcessorCacheXSize(long int) const;
|
|
|
|
|
+ bool DoesCPUSupportFeature(long int) const;
|
|
|
|
|
|
|
|
const char* GetOSName();
|
|
const char* GetOSName();
|
|
|
const char* GetHostname();
|
|
const char* GetHostname();
|
|
@@ -339,24 +339,24 @@ public:
|
|
|
const char* GetOSVersion();
|
|
const char* GetOSVersion();
|
|
|
const char* GetOSPlatform();
|
|
const char* GetOSPlatform();
|
|
|
|
|
|
|
|
- bool Is64Bits();
|
|
|
|
|
|
|
+ bool Is64Bits() const;
|
|
|
|
|
|
|
|
- unsigned int GetNumberOfLogicalCPU(); // per physical cpu
|
|
|
|
|
- unsigned int GetNumberOfPhysicalCPU();
|
|
|
|
|
|
|
+ unsigned int GetNumberOfLogicalCPU() const; // per physical cpu
|
|
|
|
|
+ unsigned int GetNumberOfPhysicalCPU() const;
|
|
|
|
|
|
|
|
bool DoesCPUSupportCPUID();
|
|
bool DoesCPUSupportCPUID();
|
|
|
|
|
|
|
|
// Retrieve memory information in MiB.
|
|
// Retrieve memory information in MiB.
|
|
|
- size_t GetTotalVirtualMemory();
|
|
|
|
|
- size_t GetAvailableVirtualMemory();
|
|
|
|
|
- size_t GetTotalPhysicalMemory();
|
|
|
|
|
- size_t GetAvailablePhysicalMemory();
|
|
|
|
|
|
|
+ size_t GetTotalVirtualMemory() const;
|
|
|
|
|
+ size_t GetAvailableVirtualMemory() const;
|
|
|
|
|
+ size_t GetTotalPhysicalMemory() const;
|
|
|
|
|
+ size_t GetAvailablePhysicalMemory() const;
|
|
|
|
|
|
|
|
LongLong GetProcessId();
|
|
LongLong GetProcessId();
|
|
|
|
|
|
|
|
// Retrieve memory information in KiB.
|
|
// Retrieve memory information in KiB.
|
|
|
LongLong GetHostMemoryTotal();
|
|
LongLong GetHostMemoryTotal();
|
|
|
- LongLong GetHostMemoryAvailable(const char* envVarName);
|
|
|
|
|
|
|
+ LongLong GetHostMemoryAvailable(const char* hostLimitEnvVarName);
|
|
|
LongLong GetHostMemoryUsed();
|
|
LongLong GetHostMemoryUsed();
|
|
|
|
|
|
|
|
LongLong GetProcMemoryAvailable(const char* hostLimitEnvVarName,
|
|
LongLong GetProcMemoryAvailable(const char* hostLimitEnvVarName,
|
|
@@ -377,60 +377,103 @@ public:
|
|
|
void RunMemoryCheck();
|
|
void RunMemoryCheck();
|
|
|
|
|
|
|
|
public:
|
|
public:
|
|
|
- typedef struct tagID
|
|
|
|
|
|
|
+ using ID = struct tagID
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
int Type;
|
|
int Type;
|
|
|
|
|
+
|
|
|
int Family;
|
|
int Family;
|
|
|
|
|
+
|
|
|
int Model;
|
|
int Model;
|
|
|
|
|
+
|
|
|
int Revision;
|
|
int Revision;
|
|
|
|
|
+
|
|
|
int ExtendedFamily;
|
|
int ExtendedFamily;
|
|
|
|
|
+
|
|
|
int ExtendedModel;
|
|
int ExtendedModel;
|
|
|
|
|
+
|
|
|
std::string ProcessorName;
|
|
std::string ProcessorName;
|
|
|
|
|
+
|
|
|
std::string Vendor;
|
|
std::string Vendor;
|
|
|
|
|
+
|
|
|
std::string SerialNumber;
|
|
std::string SerialNumber;
|
|
|
|
|
+
|
|
|
std::string ModelName;
|
|
std::string ModelName;
|
|
|
- } ID;
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ using CPUPowerManagement = struct tagCPUPowerManagement
|
|
|
|
|
|
|
|
- typedef struct tagCPUPowerManagement
|
|
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
bool HasVoltageID;
|
|
bool HasVoltageID;
|
|
|
|
|
+
|
|
|
bool HasFrequencyID;
|
|
bool HasFrequencyID;
|
|
|
|
|
+
|
|
|
bool HasTempSenseDiode;
|
|
bool HasTempSenseDiode;
|
|
|
- } CPUPowerManagement;
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ using CPUExtendedFeatures = struct tagCPUExtendedFeatures
|
|
|
|
|
|
|
|
- typedef struct tagCPUExtendedFeatures
|
|
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
bool Has3DNow;
|
|
bool Has3DNow;
|
|
|
|
|
+
|
|
|
bool Has3DNowPlus;
|
|
bool Has3DNowPlus;
|
|
|
|
|
+
|
|
|
bool SupportsMP;
|
|
bool SupportsMP;
|
|
|
|
|
+
|
|
|
bool HasMMXPlus;
|
|
bool HasMMXPlus;
|
|
|
|
|
+
|
|
|
bool HasSSEMMX;
|
|
bool HasSSEMMX;
|
|
|
|
|
+
|
|
|
unsigned int LogicalProcessorsPerPhysical;
|
|
unsigned int LogicalProcessorsPerPhysical;
|
|
|
|
|
+
|
|
|
int APIC_ID;
|
|
int APIC_ID;
|
|
|
|
|
+
|
|
|
CPUPowerManagement PowerManagement;
|
|
CPUPowerManagement PowerManagement;
|
|
|
- } CPUExtendedFeatures;
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ using CPUFeatures = struct CPUtagFeatures
|
|
|
|
|
|
|
|
- typedef struct CPUtagFeatures
|
|
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
bool HasFPU;
|
|
bool HasFPU;
|
|
|
|
|
+
|
|
|
bool HasTSC;
|
|
bool HasTSC;
|
|
|
|
|
+
|
|
|
bool HasMMX;
|
|
bool HasMMX;
|
|
|
|
|
+
|
|
|
bool HasSSE;
|
|
bool HasSSE;
|
|
|
|
|
+
|
|
|
bool HasSSEFP;
|
|
bool HasSSEFP;
|
|
|
|
|
+
|
|
|
bool HasSSE2;
|
|
bool HasSSE2;
|
|
|
|
|
+
|
|
|
bool HasIA64;
|
|
bool HasIA64;
|
|
|
|
|
+
|
|
|
bool HasAPIC;
|
|
bool HasAPIC;
|
|
|
|
|
+
|
|
|
bool HasCMOV;
|
|
bool HasCMOV;
|
|
|
|
|
+
|
|
|
bool HasMTRR;
|
|
bool HasMTRR;
|
|
|
|
|
+
|
|
|
bool HasACPI;
|
|
bool HasACPI;
|
|
|
|
|
+
|
|
|
bool HasSerial;
|
|
bool HasSerial;
|
|
|
|
|
+
|
|
|
bool HasThermal;
|
|
bool HasThermal;
|
|
|
|
|
+
|
|
|
int CPUSpeed;
|
|
int CPUSpeed;
|
|
|
|
|
+
|
|
|
int L1CacheSize;
|
|
int L1CacheSize;
|
|
|
|
|
+
|
|
|
int L2CacheSize;
|
|
int L2CacheSize;
|
|
|
|
|
+
|
|
|
int L3CacheSize;
|
|
int L3CacheSize;
|
|
|
|
|
+
|
|
|
CPUExtendedFeatures ExtendedFeatures;
|
|
CPUExtendedFeatures ExtendedFeatures;
|
|
|
- } CPUFeatures;
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
enum Manufacturer
|
|
enum Manufacturer
|
|
|
{
|
|
{
|
|
@@ -476,7 +519,7 @@ protected:
|
|
|
|
|
|
|
|
void CPUCountWindows(); // For windows
|
|
void CPUCountWindows(); // For windows
|
|
|
unsigned char GetAPICId(); // For windows
|
|
unsigned char GetAPICId(); // For windows
|
|
|
- bool IsSMTSupported();
|
|
|
|
|
|
|
+ bool IsSMTSupported() const;
|
|
|
static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); // For windows
|
|
static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); // For windows
|
|
|
|
|
|
|
|
// For Linux and Cygwin, /proc/cpuinfo formats are slightly different
|
|
// For Linux and Cygwin, /proc/cpuinfo formats are slightly different
|
|
@@ -885,7 +928,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
|
|
|
*pBuf = '\0';
|
|
*pBuf = '\0';
|
|
|
pBuf += 1;
|
|
pBuf += 1;
|
|
|
}
|
|
}
|
|
|
- lines.push_back(buf);
|
|
|
|
|
|
|
+ lines.emplace_back(buf);
|
|
|
++nRead;
|
|
++nRead;
|
|
|
}
|
|
}
|
|
|
if (ferror(file)) {
|
|
if (ferror(file)) {
|
|
@@ -899,7 +942,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
|
|
|
int LoadLines(const char* fileName, std::vector<std::string>& lines)
|
|
int LoadLines(const char* fileName, std::vector<std::string>& lines)
|
|
|
{
|
|
{
|
|
|
FILE* file = fopen(fileName, "r");
|
|
FILE* file = fopen(fileName, "r");
|
|
|
- if (file == 0) {
|
|
|
|
|
|
|
+ if (file == nullptr) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
int nRead = LoadLines(file, lines);
|
|
int nRead = LoadLines(file, lines);
|
|
@@ -1464,10 +1507,6 @@ SystemInformationImplementation::SystemInformationImplementation()
|
|
|
this->OSIs64Bit = (sizeof(void*) == 8);
|
|
this->OSIs64Bit = (sizeof(void*) == 8);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-SystemInformationImplementation::~SystemInformationImplementation()
|
|
|
|
|
-{
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
void SystemInformationImplementation::RunCPUCheck()
|
|
void SystemInformationImplementation::RunCPUCheck()
|
|
|
{
|
|
{
|
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
@@ -1564,7 +1603,7 @@ void SystemInformationImplementation::RunMemoryCheck()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Get the vendor string */
|
|
/** Get the vendor string */
|
|
|
-const char* SystemInformationImplementation::GetVendorString()
|
|
|
|
|
|
|
+const char* SystemInformationImplementation::GetVendorString() const
|
|
|
{
|
|
{
|
|
|
return this->ChipID.Vendor.c_str();
|
|
return this->ChipID.Vendor.c_str();
|
|
|
}
|
|
}
|
|
@@ -1760,7 +1799,7 @@ const char* SystemInformationImplementation::GetVendorID()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the type ID of the CPU */
|
|
/** Return the type ID of the CPU */
|
|
|
-std::string SystemInformationImplementation::GetTypeID()
|
|
|
|
|
|
|
+std::string SystemInformationImplementation::GetTypeID() const
|
|
|
{
|
|
{
|
|
|
std::ostringstream str;
|
|
std::ostringstream str;
|
|
|
str << this->ChipID.Type;
|
|
str << this->ChipID.Type;
|
|
@@ -1768,7 +1807,7 @@ std::string SystemInformationImplementation::GetTypeID()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the family of the CPU present */
|
|
/** Return the family of the CPU present */
|
|
|
-std::string SystemInformationImplementation::GetFamilyID()
|
|
|
|
|
|
|
+std::string SystemInformationImplementation::GetFamilyID() const
|
|
|
{
|
|
{
|
|
|
std::ostringstream str;
|
|
std::ostringstream str;
|
|
|
str << this->ChipID.Family;
|
|
str << this->ChipID.Family;
|
|
@@ -1776,7 +1815,7 @@ std::string SystemInformationImplementation::GetFamilyID()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Return the model of CPU present */
|
|
// Return the model of CPU present */
|
|
|
-std::string SystemInformationImplementation::GetModelID()
|
|
|
|
|
|
|
+std::string SystemInformationImplementation::GetModelID() const
|
|
|
{
|
|
{
|
|
|
std::ostringstream str;
|
|
std::ostringstream str;
|
|
|
str << this->ChipID.Model;
|
|
str << this->ChipID.Model;
|
|
@@ -1784,13 +1823,13 @@ std::string SystemInformationImplementation::GetModelID()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Return the model name of CPU present */
|
|
// Return the model name of CPU present */
|
|
|
-std::string SystemInformationImplementation::GetModelName()
|
|
|
|
|
|
|
+std::string SystemInformationImplementation::GetModelName() const
|
|
|
{
|
|
{
|
|
|
return this->ChipID.ModelName;
|
|
return this->ChipID.ModelName;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the stepping code of the CPU present. */
|
|
/** Return the stepping code of the CPU present. */
|
|
|
-std::string SystemInformationImplementation::GetSteppingCode()
|
|
|
|
|
|
|
+std::string SystemInformationImplementation::GetSteppingCode() const
|
|
|
{
|
|
{
|
|
|
std::ostringstream str;
|
|
std::ostringstream str;
|
|
|
str << this->ChipID.Revision;
|
|
str << this->ChipID.Revision;
|
|
@@ -1798,44 +1837,46 @@ std::string SystemInformationImplementation::GetSteppingCode()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the stepping code of the CPU present. */
|
|
/** Return the stepping code of the CPU present. */
|
|
|
-const char* SystemInformationImplementation::GetExtendedProcessorName()
|
|
|
|
|
|
|
+const char* SystemInformationImplementation::GetExtendedProcessorName() const
|
|
|
{
|
|
{
|
|
|
return this->ChipID.ProcessorName.c_str();
|
|
return this->ChipID.ProcessorName.c_str();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the serial number of the processor
|
|
/** Return the serial number of the processor
|
|
|
* in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
|
|
* in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
|
|
|
-const char* SystemInformationImplementation::GetProcessorSerialNumber()
|
|
|
|
|
|
|
+const char* SystemInformationImplementation::GetProcessorSerialNumber() const
|
|
|
{
|
|
{
|
|
|
return this->ChipID.SerialNumber.c_str();
|
|
return this->ChipID.SerialNumber.c_str();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the logical processors per physical */
|
|
/** Return the logical processors per physical */
|
|
|
unsigned int SystemInformationImplementation::GetLogicalProcessorsPerPhysical()
|
|
unsigned int SystemInformationImplementation::GetLogicalProcessorsPerPhysical()
|
|
|
|
|
+ const
|
|
|
{
|
|
{
|
|
|
return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical;
|
|
return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the processor clock frequency. */
|
|
/** Return the processor clock frequency. */
|
|
|
-float SystemInformationImplementation::GetProcessorClockFrequency()
|
|
|
|
|
|
|
+float SystemInformationImplementation::GetProcessorClockFrequency() const
|
|
|
{
|
|
{
|
|
|
return this->CPUSpeedInMHz;
|
|
return this->CPUSpeedInMHz;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the APIC ID. */
|
|
/** Return the APIC ID. */
|
|
|
-int SystemInformationImplementation::GetProcessorAPICID()
|
|
|
|
|
|
|
+int SystemInformationImplementation::GetProcessorAPICID() const
|
|
|
{
|
|
{
|
|
|
return this->Features.ExtendedFeatures.APIC_ID;
|
|
return this->Features.ExtendedFeatures.APIC_ID;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the L1 cache size. */
|
|
/** Return the L1 cache size. */
|
|
|
-int SystemInformationImplementation::GetProcessorCacheSize()
|
|
|
|
|
|
|
+int SystemInformationImplementation::GetProcessorCacheSize() const
|
|
|
{
|
|
{
|
|
|
return this->Features.L1CacheSize;
|
|
return this->Features.L1CacheSize;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the chosen cache size. */
|
|
/** Return the chosen cache size. */
|
|
|
-int SystemInformationImplementation::GetProcessorCacheXSize(long int dwCacheID)
|
|
|
|
|
|
|
+int SystemInformationImplementation::GetProcessorCacheXSize(
|
|
|
|
|
+ long int dwCacheID) const
|
|
|
{
|
|
{
|
|
|
switch (dwCacheID) {
|
|
switch (dwCacheID) {
|
|
|
case SystemInformation::CPU_FEATURE_L1CACHE:
|
|
case SystemInformation::CPU_FEATURE_L1CACHE:
|
|
@@ -1848,7 +1889,8 @@ int SystemInformationImplementation::GetProcessorCacheXSize(long int dwCacheID)
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool SystemInformationImplementation::DoesCPUSupportFeature(long int dwFeature)
|
|
|
|
|
|
|
+bool SystemInformationImplementation::DoesCPUSupportFeature(
|
|
|
|
|
+ long int dwFeature) const
|
|
|
{
|
|
{
|
|
|
bool bHasFeature = false;
|
|
bool bHasFeature = false;
|
|
|
|
|
|
|
@@ -3409,7 +3451,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
|
|
|
// We want to record the total number of cores in this->NumberOfPhysicalCPU
|
|
// We want to record the total number of cores in this->NumberOfPhysicalCPU
|
|
|
// (checking only the first proc)
|
|
// (checking only the first proc)
|
|
|
std::string Cores = this->ExtractValueFromCpuInfoFile(buffer, "cpu cores");
|
|
std::string Cores = this->ExtractValueFromCpuInfoFile(buffer, "cpu cores");
|
|
|
- unsigned int NumberOfCoresPerSocket = (unsigned int)atoi(Cores.c_str());
|
|
|
|
|
|
|
+ auto NumberOfCoresPerSocket = (unsigned int)atoi(Cores.c_str());
|
|
|
NumberOfCoresPerSocket = std::max(NumberOfCoresPerSocket, 1u);
|
|
NumberOfCoresPerSocket = std::max(NumberOfCoresPerSocket, 1u);
|
|
|
this->NumberOfPhysicalCPU =
|
|
this->NumberOfPhysicalCPU =
|
|
|
NumberOfCoresPerSocket * (unsigned int)NumberOfSockets;
|
|
NumberOfCoresPerSocket * (unsigned int)NumberOfSockets;
|
|
@@ -3441,7 +3483,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
|
|
|
// Linux Sparc: CPU speed is in Hz and encoded in hexadecimal
|
|
// Linux Sparc: CPU speed is in Hz and encoded in hexadecimal
|
|
|
CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer, "Cpu0ClkTck");
|
|
CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer, "Cpu0ClkTck");
|
|
|
this->CPUSpeedInMHz =
|
|
this->CPUSpeedInMHz =
|
|
|
- static_cast<float>(strtoull(CPUSpeed.c_str(), 0, 16)) / 1000000.0f;
|
|
|
|
|
|
|
+ static_cast<float>(strtoull(CPUSpeed.c_str(), nullptr, 16)) / 1000000.0f;
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
@@ -3502,9 +3544,8 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
|
|
|
cachename.push_back("D-cache"); // e.g. PA-RISC
|
|
cachename.push_back("D-cache"); // e.g. PA-RISC
|
|
|
|
|
|
|
|
this->Features.L1CacheSize = 0;
|
|
this->Features.L1CacheSize = 0;
|
|
|
- for (size_t index = 0; index < cachename.size(); index++) {
|
|
|
|
|
- std::string cacheSize =
|
|
|
|
|
- this->ExtractValueFromCpuInfoFile(buffer, cachename[index]);
|
|
|
|
|
|
|
+ for (auto& index : cachename) {
|
|
|
|
|
+ std::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer, index);
|
|
|
if (!cacheSize.empty()) {
|
|
if (!cacheSize.empty()) {
|
|
|
pos = cacheSize.find(" KB");
|
|
pos = cacheSize.find(" KB");
|
|
|
if (pos != std::string::npos) {
|
|
if (pos != std::string::npos) {
|
|
@@ -4249,24 +4290,24 @@ bool SystemInformationImplementation::QueryMemory()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** */
|
|
/** */
|
|
|
-size_t SystemInformationImplementation::GetTotalVirtualMemory()
|
|
|
|
|
|
|
+size_t SystemInformationImplementation::GetTotalVirtualMemory() const
|
|
|
{
|
|
{
|
|
|
return this->TotalVirtualMemory;
|
|
return this->TotalVirtualMemory;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** */
|
|
/** */
|
|
|
-size_t SystemInformationImplementation::GetAvailableVirtualMemory()
|
|
|
|
|
|
|
+size_t SystemInformationImplementation::GetAvailableVirtualMemory() const
|
|
|
{
|
|
{
|
|
|
return this->AvailableVirtualMemory;
|
|
return this->AvailableVirtualMemory;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-size_t SystemInformationImplementation::GetTotalPhysicalMemory()
|
|
|
|
|
|
|
+size_t SystemInformationImplementation::GetTotalPhysicalMemory() const
|
|
|
{
|
|
{
|
|
|
return this->TotalPhysicalMemory;
|
|
return this->TotalPhysicalMemory;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** */
|
|
/** */
|
|
|
-size_t SystemInformationImplementation::GetAvailablePhysicalMemory()
|
|
|
|
|
|
|
+size_t SystemInformationImplementation::GetAvailablePhysicalMemory() const
|
|
|
{
|
|
{
|
|
|
return this->AvailablePhysicalMemory;
|
|
return this->AvailablePhysicalMemory;
|
|
|
}
|
|
}
|
|
@@ -4350,7 +4391,7 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Works only for windows */
|
|
/** Works only for windows */
|
|
|
-bool SystemInformationImplementation::IsSMTSupported()
|
|
|
|
|
|
|
+bool SystemInformationImplementation::IsSMTSupported() const
|
|
|
{
|
|
{
|
|
|
return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical > 1;
|
|
return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical > 1;
|
|
|
}
|
|
}
|
|
@@ -4432,13 +4473,13 @@ void SystemInformationImplementation::CPUCountWindows()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the number of logical CPUs on the system */
|
|
/** Return the number of logical CPUs on the system */
|
|
|
-unsigned int SystemInformationImplementation::GetNumberOfLogicalCPU()
|
|
|
|
|
|
|
+unsigned int SystemInformationImplementation::GetNumberOfLogicalCPU() const
|
|
|
{
|
|
{
|
|
|
return this->NumberOfLogicalCPU;
|
|
return this->NumberOfLogicalCPU;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return the number of physical CPUs on the system */
|
|
/** Return the number of physical CPUs on the system */
|
|
|
-unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU()
|
|
|
|
|
|
|
+unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU() const
|
|
|
{
|
|
{
|
|
|
return this->NumberOfPhysicalCPU;
|
|
return this->NumberOfPhysicalCPU;
|
|
|
}
|
|
}
|
|
@@ -4739,8 +4780,8 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
|
|
|
args.reserve(3 + args_string.size());
|
|
args.reserve(3 + args_string.size());
|
|
|
args.push_back("kstat");
|
|
args.push_back("kstat");
|
|
|
args.push_back("-p");
|
|
args.push_back("-p");
|
|
|
- for (size_t i = 0; i < args_string.size(); ++i) {
|
|
|
|
|
- args.push_back(args_string[i].c_str());
|
|
|
|
|
|
|
+ for (auto& i : args_string) {
|
|
|
|
|
+ args.push_back(i.c_str());
|
|
|
}
|
|
}
|
|
|
args.push_back(nullptr);
|
|
args.push_back(nullptr);
|
|
|
|
|
|
|
@@ -5459,7 +5500,7 @@ void SystemInformationImplementation::TrimNewline(std::string& output)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** Return true if the machine is 64 bits */
|
|
/** Return true if the machine is 64 bits */
|
|
|
-bool SystemInformationImplementation::Is64Bits()
|
|
|
|
|
|
|
+bool SystemInformationImplementation::Is64Bits() const
|
|
|
{
|
|
{
|
|
|
return this->OSIs64Bit;
|
|
return this->OSIs64Bit;
|
|
|
}
|
|
}
|